4

Callback functions are usually void and don't return real data, because they are called by some type of event handling system, like the mentioned library. As this is calling the callback function, not you, it does not make much sense to return data from it. To get that return value, you would need to change the library for every bit of data, that you want. ...


3

Which Arduino's support the ATOMIC_BLOCK macros? Which Arduinos support ATOMIC_BLOCK? Only AVR (ATmel AVR architecture) microcontrollers support the ATOMIC_BLOCK macros, because these macros are part of the avr-libc library, which, you guessed it!, supports only AVR microcontrollers. AVR-based Arduinos include those based on the ATmega328 microcontroller (...


2

I have a lengthy reference question about SPI which may help you. To transfer outwards you do not need to use an interrupt. Nor is it polled. The data is simply placed in the SPI register and the hardware clocks the data out at the defined SPI rate. To transfer inwards you are just reading the register. However to know when you need to read it, you would ...


1

Original code is updated with final version. A motion sensing interrupt iterates over multiple voice playback output pins and sleeps at low power for rest of time.


1

The standard way to do this is just as you described (but with the non-blocking coding style like in the BlinkWithoutDelay example): Detach in the ISR and setting a flag and a timestamp. Then in the main code check the flag and the time since the timestamp was took. In code that looks somewhat like this (Note, that I left out some arguments of the attaching/...


1

Don't do serial prints inside an ISR. Your variable enable should be declared volatile as it changes inside an ISR. The compiler is entitled to cache the variable value if you don't do that. You are inconsistent in your use of enable. You test for LOW or HIGH but set it to 0 or 1. Now they happen to be the same, but someone might wonder. If you are going ...


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