Advertisement
Guest User

Untitled

a guest
May 29th, 2015
1,696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.24 KB | None | 0 0
  1. #include <LedControl.h>
  2. LedControl lc = LedControl(12,11,10,1);
  3.  byte chars[129][8] = {
  4.     {0,0,0,0,0,0,0,0}, // 0
  5.   {0,0,0,0,0,0,0,0}, // 1
  6.   {0,0,0,0,0,0,0,0}, // 2
  7.   {0,0,0,0,0,0,0,0}, // 3
  8.   {0,0,0,0,0,0,0,0}, // 4
  9.   {0,0,0,0,0,0,0,0}, // 5
  10.   {0,0,0,0,0,0,0,0}, // 6
  11.   {0,0,0,0,0,0,0,0}, // 7
  12.   {0,0,0,0,0,0,0,0}, // 8
  13.   {0,0,0,0,0,0,0,0}, // 9
  14.   {0,0,0,0,0,0,0,0}, // 10
  15.   {0,0,0,0,0,0,0,0}, // 11
  16.   {0,0,0,0,0,0,0,0}, // 12
  17.   {0,0,0,0,0,0,0,0}, // 13
  18.   {0,0,0,0,0,0,0,0}, // 14
  19.   {0,0,0,0,0,0,0,0}, // 15
  20.   {0,0,0,0,0,0,0,0}, // 16
  21.   {0,0,0,0,0,0,0,0}, // 17
  22.   {0,0,0,0,0,0,0,0}, // 18
  23.   {0,0,0,0,0,0,0,0}, // 19
  24.   {0,0,0,0,0,0,0,0}, // 20
  25.   {0,0,0,0,0,0,0,0}, // 21
  26.   {0,0,0,0,0,0,0,0}, // 22
  27.   {0,0,0,0,0,0,0,0}, // 23
  28.   {0,0,0,0,0,0,0,0}, // 24
  29.   {0,0,0,0,0,0,0,0}, // 25
  30.   {0,0,0,0,0,0,0,0}, // 26
  31.   {0,0,0,0,0,0,0,0}, // 27
  32.   {0,0,0,0,0,0,0,0}, // 28
  33.   {0,0,0,0,0,0,0,0}, // 29
  34.   {0,0,0,0,0,0,0,0}, // 30
  35.   {0,0,0,0,0,0,0,0}, // 31
  36.   {0,0,0,0,0,0,0,0}, // 32
  37.   {0,0,0,0,0,0,0,0}, // 33
  38.   {0,0,0,0,0,0,0,0}, // 34
  39.   {0,0,0,0,0,0,0,0}, // 35
  40.   {0,0,0,0,0,0,0,0}, // 36
  41.   {0,0,0,0,0,0,0,0}, // 37
  42.   {0,0,0,0,0,0,0,0}, // 38
  43.   {0,0,0,0,0,0,0,0}, // 39
  44.   {0,0,0,0,0,0,0,0}, // 40
  45.   {0,0,0,0,0,0,0,0}, // 41
  46.   {0,0,0,0,0,0,0,0}, // 42
  47.   {0,0,0,0,0,0,0,0}, // 43
  48.   {0,0,0,0,0,0,0,0}, // 44
  49.   {0,0,0,0,0,0,0,0}, // 45
  50.   {0,0,0,0,0,0,0,0}, // 46
  51.   {0,0,0,0,0,0,0,0}, // 47
  52.   {0,0,0,0,0,0,0,0}, // 48
  53.   {0,0,0,0,0,0,0,0}, // 49
  54.   {0,0,0,0,0,0,0,0}, // 50
  55.   {0,0,0,0,0,0,0,0}, // 51
  56.   {0,0,0,0,0,0,0,0}, // 52
  57.   {0,0,0,0,0,0,0,0}, // 53
  58.   {0,0,0,0,0,0,0,0}, // 54
  59.   {0,0,0,0,0,0,0,0}, // 55
  60.   {0,0,0,0,0,0,0,0}, // 56
  61.   {0,0,0,0,0,0,0,0}, // 57
  62.   {0,0,0,0,0,0,0,0}, // 58
  63.   {0,0,0,0,0,0,0,0}, // 59
  64.   {0,0,0,0,0,0,0,0}, // 60
  65.   {0,0,0,0,0,0,0,0}, // 61
  66.   {0,0,0,0,0,0,0,0}, // 62
  67.   {0,0,0,0,0,0,0,0}, // 63
  68.   {0,0,0,0,0,0,0,0}, // 64
  69.   {B11110110,B11111111,B00001001,B00001001,B00001001,B00001001,B11111111,B11110110}, // 65A
  70.   {B11111111,B11111111,B10001001,B10001001,B10001001,B10001001,B11111111,B01110110}, // 66B
  71.   {B11111111,B11111111,B11100111,B11000011,B11000011,B11000011,B11000011,B11000011}, // 67C
  72.   {B11111111,B11111111,B11000011,B11000011,B11000011,B11000011,B11111111,B01111110}, // 68D
  73.   {B01111110,B11111111,B11011011,B11011011,B11011011,B11000011,B11000011,B00000000},//E
  74.   {B11111110,B11111111,B00110011,B00110011,B00110011,B00110011,B00110011,B00000000},//F
  75.   {B11111110,B11111111,B10000011,B10011011,B10011011,B10011011,B10011011,B11110011},//G
  76.   {B11111111,B11111111,B00011000,B00011000,B00011000,B00011000,B11111111,B11111111},//H
  77.   {B11000011,B11000011,B11000011,B11111111,B11111111,B11000011,B11000011,B11000011},//I
  78.   {B11000011,B11000011,B11000011,B11111111,B11111111,B00000011,B00000011,B00000011},//J
  79.   {B11111111,B11111111,B00011000,B00011000,B00111100,B01100110,B11000011,B10000001},//K
  80.   {B11111111,B11111111,B11100000,B11000000,B11000000,B11000000,B11000000,B00000000},//L
  81.   {B11111111,B11111111,B00000110,B00011100,B00011100,B00000110,B11111111,B11111111},//M
  82.   {B11111111,B11111111,B00000110,B00001100,B00011000,B00110000,B11111111,B11111111},//N
  83.   {B01111110,B11111111,B11000011,B10000001,B10000001,B11000011,B11111111,B01111110},//O
  84.   {B11111110,B11111111,B00011111,B00010001,B00010001,B00011111,B00011111,B00000000},//P
  85.   {B00111110,B01111111,B01000001,B01000001,B01010001,B01100001,B01111111,B10111110},//Q
  86.   {B11111110,B11111111,B00011001,B00011001,B00011001,B00111001,B11011111,B10001110},//R
  87.   {B11001110,B11011111,B11011011,B11011011,B11011011,B11011011,B11111011,B01110011}, // 83S
  88.   {B00000011,B00000011,B00000011,B11111111,B11111111,B00000011,B00000011,B00000011}, // 84T
  89.   {B11111111,B11111111,B11000000,B11000000,B11000000,B11000000,B11111111,B11111111}, // 85U
  90.   {B00011111,B00111100,B01110000,B11100000,B11100000,B01110000,B00111100,B00011111},//V
  91.   {B00111110,B01111000,B11110000,B00111000,B00111000,B11110000,B01111000,B00111110},//W
  92.   {B10000001,B11000011,B01100110,B00011000,B00011000,B01100110,B11000011,B10000001},//X
  93.   {B00000001,B00000111,B00001100,B11111000,B11111000,B00001100,B00000111,B00000001},//Y
  94.   {B11000001,B11100001,B11110001,B10111001,B10011101,B10001111,B10000111,B10000011},//Z
  95.   {0,0,0,0,0,0,0,0}, // 91
  96.   {0,0,0,0,0,0,0,0}, // 92
  97.   {0,0,0,0,0,0,0,0}, // 93
  98.   {0,0,0,0,0,0,0,0}, // 94
  99.   {0,0,0,0,0,0,0,0}, // 95
  100.   {0,0,0,0,0,0,0,0}, // 96
  101.   {B11110110,B11111111,B00001001,B00001001,B00001001,B00001001,B11111111,B11110110}, // 65A
  102.   {B11111111,B11111111,B10001001,B10001001,B10001001,B10001001,B11111111,B01110110}, // 66B
  103.   {B11111111,B11111111,B11100111,B11000011,B11000011,B11000011,B11000011,B11000011}, // 67C
  104.   {B11111111,B11111111,B11000011,B11000011,B11000011,B11000011,B11111111,B01111110}, // 68D
  105.   {B01111110,B11111111,B11011011,B11011011,B11011011,B11000011,B11000011,B00000000},//E
  106.   {B11111110,B11111111,B00110011,B00110011,B00110011,B00110011,B00110011,B00000000},//F
  107.   {B11111110,B11111111,B10000011,B10011011,B10011011,B10011011,B10011011,B11110011},//G
  108.   {B11111111,B11111111,B00011000,B00011000,B00011000,B00011000,B11111111,B11111111},//H
  109.   {B11000011,B11000011,B11000011,B11111111,B11111111,B11000011,B11000011,B11000011},//I
  110.   {B11000011,B11000011,B11000011,B11111111,B11111111,B00000011,B00000011,B00000011},//J
  111.   {B11111111,B11111111,B00011000,B00011000,B00111100,B01100110,B11000011,B10000001},//K
  112.   {B11111111,B11111111,B11100000,B11000000,B11000000,B11000000,B11000000,B00000000},//L
  113.   {B11111111,B11111111,B00000110,B00011100,B00011100,B00000110,B11111111,B11111111},//M
  114.   {B11111111,B11111111,B00000110,B00001100,B00011000,B00110000,B11111111,B11111111},//N
  115.   {B01111110,B11111111,B11000011,B10000001,B10000001,B11000011,B11111111,B01111110},//O
  116.   {B11111110,B11111111,B00011111,B00010001,B00010001,B00011111,B00011111,B00000000},//P
  117.   {B00111110,B01111111,B01000001,B01000001,B01010001,B01100001,B01111111,B10111110},//Q
  118.   {B11111110,B11111111,B00011001,B00011001,B00011001,B00111001,B11011111,B10001110},//R
  119.   {B11001110,B11011111,B11011011,B11011011,B11011011,B11011011,B11111011,B01110011}, // 83S
  120.   {B00000011,B00000011,B00000011,B11111111,B11111111,B00000011,B00000011,B00000011}, // 84T
  121.   {B11111111,B11111111,B11000000,B11000000,B11000000,B11000000,B11111111,B11111111}, // 85U
  122.   {B00011111,B00111100,B01110000,B11100000,B11100000,B01110000,B00111100,B00011111},//V
  123.   {B00111110,B01111000,B11110000,B00111000,B00111000,B11110000,B01111000,B00111110},//W
  124.   {B10000001,B11000011,B01100110,B00011000,B00011000,B01100110,B11000011,B10000001},//X
  125.   {B00000001,B00000111,B00001100,B11111000,B11111000,B00001100,B00000111,B00000001},//Y
  126.   {B11000001,B11100001,B11110001,B10111001,B10011101,B10001111,B10000111,B10000011},//Z
  127.   {0,0,0,0,0,0,0,0}, // 123
  128.   {0,0,0,0,0,0,0,0}, // 124
  129.   {0,0,0,0,0,0,0,0}, // 125
  130.   {0,0,0,0,0,0,0,0}, // 126
  131.   {0,0,0,0,0,0,0,0}, // 127
  132.   {0,0,0,0,0,0,0,0} // 128
  133. };
  134. void setup() {
  135.  
  136.    
  137.   lc.shutdown(0,false);
  138.   lc.setIntensity(0,8);
  139.   lc.clearDisplay(0);
  140.  
  141.   Serial.begin(9600);
  142.  
  143. }
  144.  
  145. void writeChar(char chLetter, int nuDelayTime) {
  146.    
  147.       for (int i=0; i<8; i++){
  148.           lc.setRow(0,i,chars[chLetter][i]);
  149.       }
  150.        
  151.     delay(nuDelayTime);
  152.  
  153. }
  154.  
  155. void loop() {
  156.  
  157.   Serial.flush();
  158.  
  159.   if (Serial.available() > 0) {
  160.  
  161.     char chLetter = Serial.read();
  162.    
  163.     writeChar(chLetter,700);
  164.    
  165.   }  
  166.  
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement