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(); } ...


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

As Majenko says in their comments, a pin that's not connected to anything "floats" and gives unpredictable results. You either need to connect such a pin to ground through a "pull-down" resistor or to +5V through a "pull-up" resistor. (10KΩ is a good value to start with.) If you connect the pin to +5V through a pull-up resistor then you would ground it to ...


1

A "float" number has multiple possible states, besides just being a number (It never, though, can be compared to a string): A real floating point number Infinity Something that isn't a valid number The latter is what you want - that is, the internal data of the float variable doesn't represent a valid number. There are two functions in the standard math ...


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 ...


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 ...


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 ...


Only top voted, non community-wiki answers of a minimum length are eligible