Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.71 KB | None | 0 0
  1. void setup() {              
  2.   pinMode(PA2, OUTPUT);   //A
  3.   pinMode(PA3, OUTPUT);   //B
  4.   pinMode(PA4, OUTPUT);   //C
  5.   pinMode(PA5, OUTPUT);   //D
  6.   pinMode(PA6, OUTPUT);   //E
  7.   pinMode(PA7, OUTPUT);   //F
  8.   pinMode(PA8, OUTPUT);   //H
  9.   pinMode(PA11, OUTPUT);  //J
  10.   pinMode(PA12, OUTPUT);  //K
  11.   pinMode(PB5, OUTPUT);   //G1
  12.   pinMode(PA0, OUTPUT);   //G2
  13.   pinMode(PA1, OUTPUT);   //L
  14.   pinMode(PB7, OUTPUT);   //M
  15.   pinMode(PB8, OUTPUT);   //N
  16. }
  17.  
  18.  void Printaletter (bool a, bool b, bool c, bool d, bool e, bool f, bool h, bool j, bool k, bool g1, bool g2, bool l, bool m, bool n){
  19. digitalWrite(PA2, a);
  20.  digitalWrite(PA3, b);
  21.  digitalWrite(PA4, c);
  22.  digitalWrite(PA5, d);
  23.  digitalWrite(PA6, e);
  24.  digitalWrite(PA7, f);
  25.  digitalWrite(PA8, h);
  26.  digitalWrite(PA11, j);
  27.  digitalWrite(PA12, k);
  28.  digitalWrite(PB5, g1);
  29.  digitalWrite(PA0, g2);
  30.  digitalWrite(PA1, l);
  31.  digitalWrite(PB7, m);
  32.  digitalWrite(PB8, n);
  33.  };  
  34.  
  35.  void Printaletteradvanced(char letter) {
  36.   if (letter == 'A') {
  37.  Printaletter(1,1,1,0,1,1,0,0,0,1,1,0,0,0);  
  38.   }  
  39.   if (letter == 'B') {
  40.  Printaletter(1,1,1,1,0,0,0,1,0,0,1,0,1,0);  
  41.   }  
  42.   if (letter == 'C') {
  43.  Printaletter(1,0,0,1,1,1,0,0,0,0,0,0,0,0);  
  44.   }
  45.    if (letter == 'D') {
  46.  Printaletter(1,1,1,1,0,0,0,1,0,0,0,0,1,0);  
  47.   }
  48.    if (letter == 'E') {
  49.  Printaletter(1,0,0,1,1,1,0,0,0,1,0,0,0,0);  
  50.   }
  51.    if (letter == 'F') {
  52.  Printaletter(1,0,0,0,1,1,0,0,0,1,1,0,0,0);  
  53.   }
  54.    if (letter == 'G') {
  55.  Printaletter(1,0,1,1,1,1,0,0,0,0,1,0,0,0);  
  56.   }
  57.    if (letter == 'H') {
  58.  Printaletter(0,1,1,0,1,1,0,0,0,1,1,0,0,0);  
  59.   }
  60.    if (letter == 'I') {
  61.  Printaletter(1,0,0,1,0,0,0,1,0,0,0,0,1,0);  
  62.   }
  63.    if (letter == 'J') {
  64.  Printaletter(0,1,1,1,1,0,0,0,0,0,0,0,0,0);  
  65.   }
  66.    if (letter == 'K') {
  67.  Printaletter(0,0,0,0,1,1,0,0,1,1,0,0,0,1);  
  68.   }
  69.    if (letter == 'L') {
  70.  Printaletter(0,0,0,1,1,1,0,0,0,0,0,0,0,0);  
  71.   }
  72.    if (letter == 'M') {
  73.  Printaletter(0,1,1,0,1,1,1,0,1,0,0,0,0,0);  
  74.   }
  75.    if (letter == 'N') {
  76.  Printaletter(0,1,1,0,1,1,1,0,0,0,0,0,0,1);  
  77.   }
  78.    if (letter == 'O') {
  79.  Printaletter(1,1,1,1,1,1,0,0,0,0,0,0,0,0);  
  80.   }
  81.    if (letter == 'P') {
  82.  Printaletter(1,1,0,0,1,1,0,0,0,1,1,0,0,0);  
  83.   }
  84.    if (letter == 'Q') {
  85.  Printaletter(1,1,1,1,1,1,0,0,0,0,0,0,0,1);  
  86.   }
  87.    if (letter == 'R') {
  88.  Printaletter(1,1,0,0,1,1,0,0,0,1,1,0,0,1);  
  89.   }
  90.    if (letter == 'S') {
  91.  Printaletter(1,0,1,1,0,0,1,0,0,0,1,0,0,0);  
  92.   }
  93.    if (letter == 'T') {
  94.  Printaletter(1,0,0,0,0,0,0,1,0,0,0,0,1,0);  
  95.   }
  96.    if (letter == 'U') {
  97.  Printaletter(0,1,1,1,1,1,0,0,0,0,0,0,0,0);  
  98.   }
  99.    if (letter == 'V') {
  100.  Printaletter(0,0,0,0,1,1,0,0,1,0,0,1,0,0);  
  101.   }
  102.    if (letter == 'W') {
  103.  Printaletter(0,1,1,0,1,1,0,0,0,0,0,1,0,1);  
  104.   }
  105.    if (letter == 'X') {
  106.  Printaletter(0,0,0,0,0,0,1,0,1,0,0,1,0,1);  
  107.   }
  108.    if (letter == 'Y') {
  109.  Printaletter(0,1,0,0,0,1,0,0,0,1,1,0,1,0);  
  110.   }
  111.    if (letter == 'Z') {
  112.  Printaletter(1,0,0,1,0,0,0,0,1,0,0,1,0,0);  
  113.   }
  114.  
  115.  };
  116.  
  117. void loop() {
  118.  
  119.  // Printaletter(1,1,1,1,1,1,1,1,1,1,1,1,1,1); Use this to test if all the segments are connected properly.
  120.  // delay(1000);
  121.  
  122. int spd = 575; // Speed. Smaller = faster.
  123.  
  124. Printaletteradvanced('S');
  125. delay(spd);
  126. Printaletteradvanced('I');
  127. delay(spd);
  128. Printaletteradvanced('T');
  129. delay(spd);
  130. Printaletteradvanced('R');
  131. delay(spd);
  132. Printaletteradvanced('I');
  133. delay(spd);
  134. Printaletter(0,0,0,0,0,0,0,0,0,0,0,0,0,0);
  135. delay(4000);
  136.  
  137.  
  138. //Printaletter(1,1,1,1,1,1,1,1,1,1,1,1,1,1);  // Use this fuction to test if all the segments are connected properly.
  139.  
  140.  /* for (char i = 'A'; i <= 'Z'; i++ ){  // Uncomment this to test all the characters.
  141.        Printaletteradvanced(i);  
  142.        delay(1000);                
  143.  }  */
  144.  
  145.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement