Skip to content

Instantly share code, notes, and snippets.

@cchase88
Created January 6, 2013 01:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cchase88/83156afded367c106bb7 to your computer and use it in GitHub Desktop.
String my_word = "abcdefghijklmnopqrstuvwxyz";
int inner_delay = 50; // The delay between individual characters
int outer_delay = 3000;// The delay between entire words
void setup(){
// Loop through the pins we'll be using..
for(int i=5; i<13; i++){
pinMode(i, OUTPUT); // set them to be output pins
digitalWrite(i, LOW); // set them to off
}
}
void loop(){
// Loop through the word specified, taking one character at a time
for(int character = 0; character < my_word.length(); character++){
// Call the character's corresponding function
switch ( my_word.charAt(character) ){
case 'a':
a();
break;
case 'b':
b();
break;
case 'c':
c();
break;
case 'd':
d();
break;
case 'e':
e();
break;
case 'f':
f();
break;
case 'g':
g();
break;
case 'h':
h();
break;
case 'i':
i();
break;
case 'j':
j();
break;
case 'k':
k();
break;
case 'l':
l();
break;
case 'm':
m();
break;
case 'n':
n();
break;
case 'o':
o();
break;
case 'p':
p();
break;
case 'q':
q();
break;
case 'r':
r();
break;
case 's':
s();
break;
case 't':
t();
break;
case 'u':
u();
break;
case 'v':
v();
break;
case 'w':
w();
break;
case 'x':
x();
break;
case 'y':
y();
break;
case 'z':
z();
break;
case ' ':
space();
break;
case '.':
dot();
break;
}
}
delay(outer_delay);
}
void lightUp(byte seq){
for(int i=0;i<8;i++){
if(bitRead(seq, i)){
digitalWrite(i+5, HIGH);
}
else{
digitalWrite(i+5, LOW);
}
}
delay(inner_delay);
}
// For each of the characters below, the rightmost bit represents the top of the LED display.
// The zeroed byte at the end of each letter is important. It resets the LEDs to off for the
// next letter.
void a(){
lightUp(B11111110);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B11111110);
lightUp(B00000000);
}
void b(){
lightUp(B11111111);
lightUp(B10011001);
lightUp(B10011001);
lightUp(B10011001);
lightUp(B01100110);
lightUp(B00000000);
}
void c(){
lightUp(B00111100);
lightUp(B01111110);
lightUp(B10000001);
lightUp(B10000001);
lightUp(B10000001);
lightUp(B00000000);
}
void d(){
lightUp(B11111111);
lightUp(B10000001);
lightUp(B10000001);
lightUp(B01000010);
lightUp(B00111100);
lightUp(B00000000);
}
void e(){
lightUp(B11111111);
lightUp(B10001001);
lightUp(B10001001);
lightUp(B10001001);
lightUp(B10000001);
lightUp(B00000000);
}
void f(){
lightUp(B11111111);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B00000001);
lightUp(B00000000);
}
void g(){
lightUp(B01111110);
lightUp(B10000001);
lightUp(B10010001);
lightUp(B10010001);
lightUp(B01110000);
lightUp(B00000000);
}
void h(){
lightUp(B11111111);
lightUp(B00011000);
lightUp(B00011000);
lightUp(B00011000);
lightUp(B11111111);
lightUp(B00000000);
}
void i(){
lightUp(B10000001);
lightUp(B10000001);
lightUp(B11111111);
lightUp(B10000001);
lightUp(B10000001);
lightUp(B00000000);
}
void j(){
lightUp(B11100001);
lightUp(B10000001);
lightUp(B11111111);
lightUp(B00000001);
lightUp(B00000001);
lightUp(B00000000);
}
void k(){
lightUp(B11111111);
lightUp(B00011000);
lightUp(B00100100);
lightUp(B01000010);
lightUp(B10000001);
lightUp(B00000000);
}
void l(){
lightUp(B11111111);
lightUp(B10000000);
lightUp(B10000000);
lightUp(B10000000);
lightUp(B10000000);
lightUp(B00000000);
}
void m(){
lightUp(B11111111);
lightUp(B00000010);
lightUp(B00001100);
lightUp(B00000010);
lightUp(B11111111);
lightUp(B00000000);
}
void n(){
lightUp(B11111111);
lightUp(B00000110);
lightUp(B00011000);
lightUp(B01100000);
lightUp(B11111111);
lightUp(B00000000);
}
void o(){
lightUp(B01111110);
lightUp(B10000001);
lightUp(B10000001);
lightUp(B10000001);
lightUp(B01111110);
lightUp(B00000000);
}
void p(){
lightUp(B11111110);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B00001110);
lightUp(B00000000);
}
void q(){
lightUp(B01111110);
lightUp(B10000001);
lightUp(B10100001);
lightUp(B11000001);
lightUp(B01111110);
lightUp(B00000000);
}
void r(){
lightUp(B11111110);
lightUp(B00010001);
lightUp(B00010001);
lightUp(B00110001);
lightUp(B11001110);
lightUp(B00000000);
}
void s(){
lightUp(B01001110);
lightUp(B10011001);
lightUp(B10011001);
lightUp(B10011001);
lightUp(B01110010);
lightUp(B00000000);
}
void t(){
lightUp(B00000001);
lightUp(B00000001);
lightUp(B11111111);
lightUp(B00000001);
lightUp(B00000001);
lightUp(B00000000);
}
void u(){
lightUp(B01111111);
lightUp(B10000000);
lightUp(B10000000);
lightUp(B10000000);
lightUp(B01111111);
lightUp(B00000000);
}
void v(){
lightUp(B00011111);
lightUp(B01100000);
lightUp(B10000000);
lightUp(B01100000);
lightUp(B00011111);
lightUp(B00000000);
}
void w(){
lightUp(B11111111);
lightUp(B01000000);
lightUp(B00110000);
lightUp(B01000000);
lightUp(B11111111);
lightUp(B00000000);
}
void x(){
lightUp(B11000111);
lightUp(B00101000);
lightUp(B00010000);
lightUp(B00101000);
lightUp(B11000111);
lightUp(B00000000);
}
void y(){
lightUp(B00000111);
lightUp(B00001000);
lightUp(B11110000);
lightUp(B00001000);
lightUp(B00000111);
lightUp(B00000000);
}
void z(){
lightUp(B11000001);
lightUp(B10110001);
lightUp(B10011001);
lightUp(B10001101);
lightUp(B10000011);
lightUp(B00000000);
}
void space(){
lightUp(B0000000);
lightUp(B0000000);
lightUp(B0000000);
lightUp(B0000000);
lightUp(B0000000);
lightUp(B0000000);
}
void dot(){
lightUp(B1000000);
lightUp(B0000000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment