New answers tagged

3

After color = Serial.readString(); color also contains a newline character. You can remove that by adding the line color.trim();, or even better, avoid the newline altogether by using Serial.readStringUntil('\n'); which discards the terminator character. Also, you could, and maybe should, avoid using the String class and use: char color[10]; // char array as ...


1

Well I don't know exactly why this work, but base on this question this. To solve this I should add 'inline' keyword in every method definition on the MPU6050_6Axis_MotionApps20.h Like this: inline uint8_t MPU6050::dmpInitialize() { // reset device DEBUG_PRINTLN(F("\n\nResetting MPU6050...")); reset(); delay(30); // wait after reset ...


3

PB7 is pin 13. That's the traditional LED pin. The bootloader blinks that LED to indicate it's active. If you want other behaviour then you will have to compile your own version of the bootloader that doesn't blink the LED.


0

Your problem is that you aren't sending the values from python in bytes. A more reliable way is to send the data in bytes like dat.write(b'1') and then receive it on the Arduino using Serial.readString(). I also had many issues with this and this is the best solution. "https://roboticsbackend.com/raspberry-pi-arduino-serial-communication/#:~:text=The%...


0

sorry for posting here after years but i need some help This is my arduino code, the raspberry pi code is the same as above. #include <Wire.h> #define SLAVE_ADDRESS 0x04 volatile boolean receiveFlag = false; char temp[32]; String command; void setup() { // initialize i2c as slave Wire.begin(SLAVE_ADDRESS); // define callbacks for i2c communication Wire....


-1

Good Job, you are right on, the transistor is rated at 200 mA which is adequate for the job. The flyback diode will protect your system and the transistor. the drain source drop would be maybe 0.01V on a bad day depending on the RDSon. You will probably need a little lower value base resistor depending on the gain of your transistor. I would use something ...


-1

If the coil is 70 ohms and it's driven by 5V, it should draw about 5/70 = 71 mA. That's pushing the 2n3904 a bit hard, and doesn't even account for inductive effects. (It's a small-signal transistor.) Do you have an NPN power transistor to try, just as a test? If its current gain (beta) is too low, use a Darlington configuration by combining it with your ...


1

The number is as many as you want. There are switches that allow you to select different busses and each buss supports its full complement. From my point you are trying to use a solution before you have defined the problem fully. I have a feeling they will not be within a few inches of each other so consider an alternative designed for this type of use. CAN,...


0

This is NOT an answer to the question, but I did some (major) refactoring which make it much more clear what is happening. I think you made some mistake within the (refactored) method Sensor::UpdateState. File <.ino>: #include "Sensors.h" Sensors _sensors; void setup() { Serial.begin (9600); _sensors.Init(); } void loop() { ...


4

The limiting factor is the bus capacitance. This is the limit of the total capacitance of the bus from all devices connected to it plus the capacitance of the wires used. It is also affected by the value of the pullup resistors. The limit, according to the specifications, is 400pF. An Arduino has an input capacitance of 10pF. So ignoring the wires that's ...


1

An NPN bipolar transistor requires a current to flow from base to the emitter which is then multiplied by the beta of the transistor controlling the maximum current which flows from the collector to the emitter. A 2n2222 beta is about 100. Let us calculate the amount of current which will be allowed to flow from the collector to the emitter of the 2n2222 ...


1

Start with the BlinkWithoutDelay example code and make modifications to suit your needs. This is the original code. /* Blink without Delay Turns on and off a light emitting diode (LED) connected to a digital pin, without using the delay() function. This means that other code can run at the same time without being interrupted by the LED code. ...


0

What you're searching for is called "non-blocking programming", a technique in which you frequently test or evaluate whether something needs to be done, and either do it or not, but move on immediately. For one motor, you could block successfully (do nothing else while you wait for something to happen): start/wait/stop/reverse/wait/stop/... etc. ...


0

The simplest approach to include a delay in your sketch is to call the Arduino delay() function. Pass this function a delay value in milliseconds. For example, a 1 second delay is 1000 milliseconds. As simple as this method is, it is not recommended if your sketch is required to accomplish tasks during the delay. This is a common requirement and ...


1

You include the Tone library and you use the tone() function from core. They are in conflict. Use tone1.tone() or remove the Tone library and use the tone() function.


1

I don't know why the three of them don't work together. I already answered that question in my answer to your previous question. why I'm using this calculation in my code and why if I removed it the lidar will not give me any measurement? That code part is reading the data from the first SoftwareSerial interface. If you don't read this data (by removing ...


0

I can't answer the first part of your question as I don't understand what you're asking. However: I don't know why the three of them don't work together. That doesn't work for 2 reasons: Your receiving routine specifically references only one TFMini serial port, and It is impossible to receive from more than one SoftwareSerial port at a time. If you ...


3

Your current signal will also show PWM, so you will need to filter that before measuring. It would be much simpler if you could rearrange your circuit to put the sense resistor on the ground side of the MOSFET, since then you can use a simple RC filter and a single A0 measurement. Also, you wouldn't have to worry about the no-load voltage from the solar ...


1

https://www.forward.com.au/pfod/CheapWifiShield/index.html provides a very inexpensive wifi addon for Arduino The WiFi Shield needs just two parts, 4 bits of wire and some soldering equipment. Parts List:- Adafruit HUZZAH ESP8266 Breakout US$9.95 + shipping Uno Protoshield US$1.88 + shipping Total US$11.83 (as of June 2015) For an even cheaper version ~US7 ...


2

No. Not even remotely. Android runs on a powerful computer not a tiny embedded microcontroller.


1

Besides connecting all the grounds, a "good idea" whenever working with solenoids or magnetic (as opposed to solid state) relays is to add protection against inductive kickback, which can create really high voltages (hundreds of volts) when the current through an inductor changes suddenly. (The voltage is the product of the inductance and the rate-...


1

Figuring out your current needs is simply a matter of adding everything up. If you have 5 2 amp motors, you'll need 5 x 2, or 10 amps just to drive the motors. You should probably have at least 20% extra capacity, so I'd suggest having a 12V power supply that can put out at least 12A. 15A would be better. The stiffer your power supply the less it will "...


0

No, you can't. Nextion displays contain their own microcontroller with their own closed-source firmware on them. You need that firmware to have a clue what is in Nextion files, and only Nextion have that firmware. While it may be possible to reverse engineer Nextion display data and write your own software to interpret it, it would be a huge job with little ...


2

After pressing sw1, the first if works. After releasing sw1 (it's a pushbutton), the line while (digitalRead(sw1) == HIGH); will make the code just sit there forever without continuing with the rest of the code until you press sw1 again, which will be caught by the first if unless you release 'sw1' inhumanly fast. So, once you have pressed and released sw1, ...


2

Sorry I'm a bit late (5 years late) but hopefully this can help someone who's just now trying to do this! There's an old obscure Sunfounder library, "rfid1.h" that lets you declare every pin. Like this: rfid.begin(IRQ,SCK,MOSI,MISO,NSS,RST); It's a bit hard to find the library online these days, but at the bottom of this page (http://wiki....


1

This is something that is far far easier to measure than to try and calculate. Here's an Arduino Uno R2 with a simple sketch that just turns on D2. Green is the power (7V to the barrel jack) and yellow is D2. As you can see it takes 1.544 seconds (according to the resolution of my oscilloscope which, over those time scales, isn't that great) before D2 is ...


1

Try lowering the rpm in the code. I had a similar issue with anything over about 18rpm using certain libraries with certain stepper motors.


Top 50 recent answers are included