No schematic really, just leds on pins 3-12 connected to the breadboard's power rail, which is connected to ground through a 330 Ohm resistor, and a button connecting pin 2 to ground. The button wakes the arduino from sleep mode, and it prints its message then goes back to sleep. Here's my code:
#include <avr/power.h>
#include <avr/sleep.h>int ledpin[] = {12,11,10,9,4,3,8,7,6,5};
int dotTime = 1;int _[] = {0b0000000000,
0b0000000000,
0b0000000000,
0b0000000000,
0b0000000000};
int A[] = {0b1111111100,
0b0000010010,
0b0000010001,
0b0000010010,
0b1111111100};
int B[] = {0b1111111111,
0b1000010001,
0b1000010001,
0b0100101010,
0b0011000100};
int C[] = {0b0011111100,
0b0100000010,
0b1000000001,
0b0100000010,
0b0011001100};
int D[] = {0b1111111111,
0b1000000001,
0b1000000001,
0b0100000010,
0b0011111100};
int E[] = {0b1111111111,
0b1000010001,
0b1000010001,
0b1000010001,
0b1000000001};
int F[] = {0b1111111111,
0b0000010001,
0b0000010001,
0b0000010001,
0b0000000001};
int G[] = {0b0011111100,
0b0100000010,
0b1001000001,
0b0101000010,
0b1111001100};
int H[] = {0b1111111111,
0b0000010000,
0b0000010000,
0b0000010000,
0b1111111111};
int I[] = {0b0000000000,
0b1000000001,
0b1111111111,
0b1000000001,
0b0000000000};
int J[] = {0b0011111111,
0b0100000001,
0b1000000001,
0b0100000000,
0b0011000000};
int K[] = {0b1111111111,
0b0000010000,
0b0000101000,
0b0001000100,
0b1110000011};
int L[] = {0b1111111111,
0b1000000000,
0b1000000000,
0b1000000000,
0b1000000000};
int M[] = {0b1111111100,
0b0000000011,
0b0000001100,
0b0000000011,
0b1111111100};
int N[] = {0b1111111111,
0b0000000110,
0b0000011000,
0b0001100000,
0b1111111100};
int O[] = {0b0011111100,
0b0100000010,
0b1000000001,
0b0100000010,
0b0011111100};
int P[] = {0b1111111111,
0b0000010001,
0b0000010001,
0b0000001010,
0b0000000100};
int Q[] = {0b0011111100,
0b0100000010,
0b1000000001,
0b0100000010,
0b1011111100};
int R[] = {0b1111111111,
0b0000010001,
0b0000010001,
0b0000101010,
0b1111000100};
int S[] = {0b0011000100,
0b0100001010,
0b1000010001,
0b0100100010,
0b0011001100};
int T[] = {0b0000000001,
0b0000000001,
0b1111111111,
0b0000000001,
0b0000000001};
int U[] = {0b0111111111,
0b1000000000,
0b1000000000,
0b1000000000,
0b0111111111};
int V[] = {0b0000011111,
0b0011100000,
0b1100000000,
0b0011100000,
0b0000011111};
int W[] = {0b0011111111,
0b1100000000,
0b0011000000,
0b1100000000,
0b0011111111};
int X[] = {0b1100000011,
0b0011001100,
0b0000110000,
0b0011001100,
0b1100000011};
int Y[] = {0b0000000011,
0b0000001100,
0b1111110000,
0b0000001100,
0b0000000011};
int Z[] = {0b1100000001,
0b1011000001,
0b1000110001,
0b1000001101,
0b1000000011};void setup() {
Serial.begin(9600);
for (int i = 0; i < 10; i++) {
pinMode(ledpin*, OUTPUT);*
- }*
- pinMode(2, INPUT);*
- digitalWrite(2, 1);*
- digitalWrite(13, 1);*
}
int pow(int num, int power) {- return round(pow((double)num, (double)power));*
}
void printLetter(int letter[]) {- delay(dotTime);*
- for (int i = 0; i < 5; i++) {*
- for (int j = 0; j < 10; j++) {*
_ digitalWrite(ledpin[j], (letter & pow(2, j)) ? HIGH : LOW);_
_ Serial.print((letter & pow(2, j)) ? "O" : " ");
* }
Serial.print("|\n");
delay(dotTime);
}
Serial.print("\n");
for (int i = 0; i < 10; i++)
digitalWrite(ledpin, 0);
delay(dotTime);
}
void wake() {}
void loop() {
delay(1);
printLetter(H);
printLetter(E);
printLetter(L);
printLetter(L);
printLetter(O);_
printLetter(_);** attachInterrupt(0, wake, LOW);*
* delay(1);*
* set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
_ detachInterrupt(0);
}[/quote]*
Note: the led pins are not in numerical order in the array. This is a result of the way I had to route them to get ten consecutive rows on the breadboard connected to digital pins. The same routing will work if you are using a bare atmega (as this board has the same pinout), but for any other board, you will probably want to change that._