New answers tagged

0

In addition to using the do construct incorrectly, you are also using an approach that won't work. You generally should not use a do-while statement in Arduino. That causes your code to "stick" in the body of the do-while statement while the while condition is true, which prevents the rest of your code from executing. You also should not use the delay() ...


0

You are using the do function wrongly: Like this: do{ programState = 1; } It should be something like: do { programState = 1; } while (`some condition`); Where some condition is a condition that repeat the parts in { and } in case some condition is true. However, besides that, it does not make sense normally to assign a variable in a while loop as ...


1

Uno's Mega's and so on have a separate MCU (u3) that contains the boot loader and is responsible for the USB connection and for driving the virtual serial port. Micros ( and also Leonardos and Esploras ) have built in USB support in the main MCU (u4). So if your program does something that breaks the USB part of the MCU the communication breaks also. This ...


3

This is because the output of the serial is buffered. It's still sending the first bit of data while you change the baud rate - and from then on it's just a complete mess. You need to force it to finish sending before you can change the baud rate by using Serial.flush(): void setup() { Serial.begin(115200); Serial.println("Hello"); Serial.flush(); } ...


1

The reason why you can't reference the parent folder of your sketch when compiling is because the Arduino IDE doesn't compile your sketch in that folder. Instead it writes out the files from the IDE itself into temporary files in a "build" folder and compiles them in there - so the parent folder then does not contain your header file because the IDE has no ...


0

I guess your problem is, that you are using SoftwareSerial. Doing Serial in software means, that you can only listen at one interface at a time, thus only one of the fingerprint sensors work at a time. But you are using the Arduino Mega, which has 4 hardware Serial interfaces. They are named Serial and SerialX (with X being 1,2 or 3). You can give a ...


0

In this situation it is far more efficient to use #define and conditional compilation. // Uncomment this for tinkercad // #define INVERTED #ifdef INVERTED # define ON HIGH # define OFF LOW #else # define ON LOW # define OFF HIGH #endif Then just use ON or OFF in place of HIGH and LOW. digitalWrite(3, ON); But the reason you have a problem is not ...


0

See my answer in this thread: How to connect Big Dome Button with arduino That thread explains how to wire up a switch and write code that increments a counter each time a button is pressed. The bits you care about: Connect one lead of the switch to a digital input, and the other lead to ground. Then set your switch pin to INPUT_PULLUP mode. Now your ...


2

This construct does work in Arduino IDE. In fact, = { 0 } is one of the iconic idioms of C language. It can be used to zero-initialize an object of any type in C. In C++ things are a bit more complicated. It will work for an int [100] array, but in general case you might be better off with = {} initializer to achieve the same effect where applicable. It is ...


1

I think Gerben is on to something. If you re-initialize the gps at every loop and then never give it time to acquire the gps signal then your if (GPS.fix) condition is never true and you never print out any other data. All your timing code is inside the GPS.fix condition which doesn't happen until you have a fix. Try putting the init code inside your ...


0

As I understood it from your comments, your aim is not really to store the actual positions of the wheels or your robot, but to save and repeat the actions, that the robot did. (Meaning you don't have a "position" here, but only a measurement of wheel speed) If that is true, then you can save this in a 2-dimensional array with the element form {...


0

The below was the issue, i was using the wrong broad and processor. Thanks for the help!


0

In late 2019 we have the Deviot Sublime Text 3 plugin that runs on top of PlatformIO.


1

Remove the & in the master code line, change radio.read(message, sizeof(message)); to radio.read(message, sizeof(message)); message is an array, so either you should pass the address of the first character (&message[0]), or simply pass message. Another problem is sending a String in the slave code (using type String). It's better not to use ...


0

Yes it's possible. Try this one tutorial. https://circuits4you.com/2019/01/10/esp8266-nodemcu-https-secured-get-request/


0

The else case is executed every time the other if and else if conditions are not true. That means if it is not 5 sec and not 30 sec and no button is pressed, the relay is switched off. To achieve what you want is not that easy, because you have to synchronize button press and button release with the timer actions. First you must specify what you exactly ...


1

The only explanation I have is, that the Software serial switch off the interrupts globally when it operates (print). If interrupts are locked when the timer completes, you loose a tick. It does not explain the different behavior of the four value pairs, but there are some issues reported in a german forum. They did not find an answer, but the assumed it ...


0

It's fairly easy to use a standalone Arduino chip. The one tricky thing about the chip used for the official boards is that they are fused to use the faster (and more accurate) external oscillator that's mounted on the board. This applies even when you purchase the loose chips, since most are resold with intention of being installed in an Arduino board to ...


1

The Serial output on an Arduino is quite slow. By printing your output, you will slow down the readings so much that it will appear to be nonsense. You should collect a series of readings into a C array of floats in RAM, stop recording, and then log that array of values. Note that you don't have a lot of RAM to work with on most Arduinos, so you will only ...


1

You mean that the STK500 v2 programmer uses an emulated serial port rather than direct USB? Then I guess there is a bug in the Arduino IDE. The file programmers.txt contains the following lines describing the programmer: avrispmkii.name=AVRISP mkII avrispmkii.communication=usb avrispmkii.protocol=stk500v2 avrispmkii.program.protocol=stk500v2 avrispmkii....


0

I would say you have to select the Arduino as ISP Programmer. Not the mkII ISP. Perhaps the attiny board library can handle connection to attiny dev boards over usb if you use the standard programmer. But that's just a very very rough guess. But selecting the Arduino as ISP is a requirement. Edit: No you can not use the Arduino as ISP if you use an STK500 ...


Top 50 recent answers are included