]> git.piffa.net Git - sketchbook_andrea/blob - advanced_projects/narcoleptic_Blink_power_save/narcoleptic_Blink_power_save.ino
Structured data types
[sketchbook_andrea] / advanced_projects / narcoleptic_Blink_power_save / narcoleptic_Blink_power_save.ino
1 /*
2   Blink with Narcoleptic
3   
4   Normal Blink on a Uno uses 33.22 - 35.10ma
5   Narcoleptic version on a Uno uses 24.38 - 26.08ma
6   
7   Normal Blink on a Nano uses 21.01 - 24.28ma
8   Narcoleptic version on a Nano uses 6.73 - 9.75ma
9   
10   This should be way more efficient on a Arduino Mini 
11   that has no USB chip - regulator. Arduino Mini should go from 17.2 to 3.2ma.
12   
13   Turns on an LED on for one second, then off for one second, repeatedly.
14  
15   This example code is in the public domain.
16  */
17  
18 // Pin 13 has an LED connected on most Arduino boards.
19 // give it a name:
20 int led = 13;
21 #include <Narcoleptic.h>
22 // the setup routine runs once when you press reset:
23 void setup() {                
24   // initialize the digital pin as an output.
25   pinMode(led, OUTPUT);     
26 }
27
28 // the loop routine runs over and over again forever:
29 void loop() {
30   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
31    Narcoleptic.delay(1000);               // wait for a second
32   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
33    Narcoleptic.delay(1000);               // wait for a second
34 }