I am trying to use the sleep function in lieu of delay()
, but when I include sleep()
, I get Sweep.cpp:60:10: error: ‘sleep’ was not declared in this scope
I read some place, about #include <avr/sleep.h>
but that is a fail.
#include <avr/sleep.h>
void setup() {
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
sleep(1); // wait for a second
digitalWrite(13, LOW); // set the LED off
sleep(1000); // wait for a second
}
I was able to locate sleep.h
:
$ locate sleep.h | grep avr
/usr/lib/avr/include/avr/sleep.h
So then I started reading avr/sleep.h
, and it seems like I'm doing it right, according to the examples. So, why might this be failing?