Advertisement
Drakkheen

Untitled

Mar 2nd, 2021
1,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //update from SAnwandter
  2.  
  3. #define ROW_1 4
  4. #define ROW_2 5
  5. #define ROW_3 6
  6. #define ROW_4 7
  7. #define ROW_5 8
  8.  
  9. #define COL_1 13
  10. #define COL_2 12
  11. #define COL_3 11
  12. #define COL_4 10
  13. #define COL_5 9
  14.  
  15.  
  16. const byte rows[] = {
  17.   ROW_1, ROW_2, ROW_3, ROW_4, ROW_5};
  18. const byte col[] = {
  19.   COL_1, COL_2, COL_3, COL_4, COL_5};
  20.  
  21. // The display buffer
  22. // It's prefilled with a smiling face (1 = ON, 0 = OFF)
  23.  
  24. byte EX [] = {B00000, B00000, B00000, B00000, B00000};
  25. byte ALL [] = {B11111, B11111, B11111, B11111, B11111};
  26.  
  27. byte A [] = {B01100, B10010, B11110, B10010, B10010};
  28. byte B [] = {B11100, B10010, B11110, B10010, B11100};
  29. byte C [] = {B01110, B10000, B10000, B10000, B01110};
  30. byte D [] = {B11100, B10010, B10010, B10010, B11100};
  31. byte E [] = {B11110, B10000, B11100, B10000, B11110};
  32. byte F [] = {B11110, B10000, B11100, B10000, B10000};
  33. byte G [] = {B01110, B10000, B10110, B10010, B11110};
  34. byte H [] = {B10010, B10010, B11110, B10010, B10010};
  35. byte I [] = {B00100, B00100, B00100, B00100, B00100};
  36. byte J [] = {B00100, B00100, B00100, B10100, B11100};
  37. byte K [] = {B10010, B10100, B11000, B10100, B10010};
  38. byte L [] = {B10000, B10000, B10000, B10000, B11110};
  39. byte M [] = {B10001, B11011, B10101, B10001, B10001};
  40. byte N [] = {B10010, B11010, B10110, B10010, B10010};
  41. byte O [] = {B01100, B10010, B10010, B10010, B01100};
  42. byte P [] = {B11100, B10010, B10010, B11100, B10000};
  43. byte Q [] = {B01110, B10001, B10101, B10010, B01101};
  44. byte R [] = {B11100, B10010, B11100, B10010, B10010};
  45. byte S [] = {B11110, B10000, B11110, B00010, B11110};
  46. byte T [] = {B11111, B00100, B00100, B00100, B00100};
  47. byte U [] = {B10010, B10010, B10010, B10010, B01100};
  48. byte V [] = {B10001, B10001, B10001, B01010, B00100};
  49. byte W [] = {B10001, B10001, B10101, B10101, B01110};
  50. byte X [] = {B10010, B10010, B01100, B10010, B10010};
  51. byte Y [] = {B10001, B10001, B01110, B00100, B00100};
  52. byte Z [] = {B11110, B00010, B00100, B01000, B11110};
  53.  
  54. float timeCount = 0;
  55.  
  56. void setup()
  57. {
  58.   // Open serial port
  59.   Serial.begin(9600);
  60.  
  61.   // Set all used pins to OUTPUT
  62.   // This is very important! If the pins are set to input
  63.   // the display will be very dim.
  64.   for (byte i = 4; i <= 13; i++)
  65.     pinMode(i, OUTPUT);
  66.  
  67. }
  68.  
  69. void loop() {
  70.    drawScreen(I);
  71. }
  72. void  drawScreen(byte buffer2[])
  73. {
  74.   // Turn on each row in series
  75.   for (byte i = 0; i < 5; i++)        // count next row
  76.   {
  77.     digitalWrite(rows[i], HIGH);    //initiate whole row
  78.     for (byte a = 0; a < 5; a++)    // count next row
  79.     {
  80.       // if You set (~buffer2[i] >> a) then You will have positive
  81.       digitalWrite(col[a], (buffer2[i] >> a) & 0x01); // initiate whole column
  82.  
  83.       delayMicroseconds(100);       // uncoment deley for diferent speed of display
  84.       //delayMicroseconds(1000);
  85.       //delay(10);
  86.       //delay(100);
  87.  
  88.       digitalWrite(col[a], HIGH);      // reset whole column
  89.     }
  90.     digitalWrite(rows[i], LOW);     // reset whole row
  91.     // otherwise last row will intersect with next row
  92.   }
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement