New answers tagged

2

Reading and writing of serial data are separate functions. When you .write() you just append the data to the TX buffer. When you .read() you just take the next character from the RX buffer. All actual sending and receiving, and filling/emptying of the buffers is done inside the ISRs for the UART module. That said, you really shouldn't use Serial inside an ...


0

The Uno+WiFi board is an Uno. With DIP switches 3 and 4 in ON position it is a normal Arduino Uno clone with CH340 chip for USB. All the pin headers at board sides and the ICSP pins are as on an Arduino Uno. Every sketch for Uno will work. The esp8266 is added for WiFi functionality. The DIP switches allow to program the esp8266 over the CH340 or to connect ...


1

How can one explain that using this code I get this toggle frequency on the digital pin ? Code takes time to execute. Your ISR, when compiled, looks like: ISR(TIMER0_COMPA_vect) { 124: 1f 92 push r1 126: 0f 92 push r0 128: 0f b6 in r0, 0x3f ; 63 12a: 0f 92 push r0 12c: 11 24 eor ...


1

Generally, if you want to find identifiers in your Arduino board support, you can run the ctags program on the libc and Arduino core files. ctags is used as part of the build process in its effort to generate C++ declarations for you. So it is generally available to you as an Arduino user. You should find ctags or ctags.exe in: /path/to/arduino15/builtin/...


1

Make a statemachine. Take a piece of paper and draw out the order of operation and each time you are waiting you specify what each button will do. So for example each time button 1 is pushed you increment the counter and change the display. When waiting for a timeout you check if(startTimestamp - millis() > timeout) for the next step. Then give each ...


0

There is no such thing as an "interrupt on a value changing" since that is something that only exists in software, and interrupts are things triggered by hardware. All you can do is check the value in loop() and send the data if the value is above your threshold. If you want to wake from sleep then you will have to do that periodically through ...


0

Turns out that, in the Cortex Mx processors, interrupts don't work the same way as older 8- and 16-bit Arduino-style chips work. As far as I can tell, there's only one ISR that's connected to the pins. In that routine, you've gotta check the status of the pins you are monitoring and set a global variable accordingly. I'm not sure this is the only way to do ...


2

First, beware that what you have written is not a volatile pointer, it's a pointer to volatile data. If you always access the object through this pointer, you should be fine. If you use the pointer in the ISR, but access the data directly in the main code (bypassing the volatile qualifier), then the program could fail. Consider the following: void loop() { ...


Top 50 recent answers are included