j0h

flipped text ardunio

j0h
Apr 23rd, 2022
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>  //i2c dev scan
  2. // include the library code:
  3. #include <Adafruit_LiquidCrystal.h>
  4. #include <strings.h>
  5. Adafruit_LiquidCrystal lcd(0);
  6. char *text={""};
  7.  
  8. //upside down char glyphs... default characters are 7x5 1 px on the bottom space
  9. byte uA[8] = {  B00000,  B10001,  B10001,  B10001,  B11111,  B10001,  B10001,  B01110};
  10. byte uB[8] = {  B00000,  B01111,  B10001,  B10001,  B01111,  B10001,  B10001,  B01111};
  11. byte uC[8] = {  B00000,  B01110,  B10001,  B00001,  B00001,  B00001,  B10001,  B01110};
  12. byte uD[8] = {  B00000,  B00111,  B01001,  B10001,  B10001,  B10001,  B01001,  B00111};
  13. byte uE[8] = {  B00000,  B11111,  B00001,  B00001,  B01111,  B00001,  B00001,  B11111};
  14. byte uF[8] = {  B00000,  B00001,  B00001,  B00001,  B01111,  B00001,  B00001,  B11111};
  15. byte uG[8] = {  B00000,  B11110,  B10001,  B10001,  B11101,  B00001,  B10001,  B01110};
  16. byte uH[8] = {  B00000,  B10001,  B10001,  B10001,  B11111,  B10001,  B10001,  B10001};
  17. byte uI[8] = {  B00000,  B01110,  B00100,  B00100,  B00100,  B00100,  B00100,  B01110};
  18. byte uJ[8] = {  B00000,  B00110,  B01001,  B01000,  B01000,  B01000,  B01000,  B11100};
  19. byte uK[8] = {  B00000,  B10001,  B01001,  B00101,  B00011,  B00101,  B01001,  B10001};
  20. byte uL[8] = {  B00000,  B01111,  B00001,  B00001,  B00001,  B00001,  B00001,  B00001};
  21. byte uM[8] = {  B00000,  B10001,  B10001,  B10001,  B10101,  B10101,  B11011,  B10001};
  22. byte uN[8] = {  B00000,  B10001,  B10001,  B11001,  B10101,  B10011,  B10001,  B10001};
  23. byte uO[8] = {  B00000,  B01110,  B10001,  B10001,  B10001,  B10001,  B10001,  B01110};
  24. byte uP[8] = {  B00000,  B00001,  B00001,  B00001,  B01111,  B10001,  B10001,  B01111};
  25. byte uQ[8] = {  B00000,  B10110,  B01001,  B10101,  B10001,  B10001,  B10001,  B01110};
  26. byte uR[8] = {  B00000,  B10001,  B01001,  B00101,  B01111,  B10001,  B10001,  B01111};
  27. byte uS[8] = {  B00000,  B01111,  B10000,  B10000,  B01110,  B00001,  B00001,  B11110};
  28. byte uT[8] = {  B00000,  B00100,  B00100,  B00100,  B00100,  B00100,  B00100,  B11111};
  29. byte uU[8] = {  B00000,  B01110,  B10001,  B10001,  B10001,  B10001,  B10001,  B10001};
  30. byte uV[8] = {  B00000,  B00100,  B01010,  B10001,  B10001,  B10001,  B10001,  B10001};
  31. byte uW[8] = {  B00000,  B01010,  B10101,  B10101,  B10101,  B10001,  B10001,  B10001};
  32. byte uX[8] = {  B00000,  B10001,  B10001,  B01010,  B00100,  B01010,  B10001,  B10001};
  33. byte uY[8] = {  B00000,  B00100,  B00100,  B00100,  B01010,  B10001,  B10001,  B10001};
  34. byte uZ[8] = {  B00000,  B11111,  B00001,  B00010,  B00100,  B01000,  B10000,  B11111};
  35. //pockets
  36. byte cornerA[]={B11111,B10000,B10000,B10000,B10000,B10000,B10000,B10000};//top left
  37. byte cornerB[]={B10000,B10000,B10000,B10000,B10000,B10000,B10000,B11111};//btm left
  38. byte cornerC[]={B11111,B00001,B00001,B00001,B00001,B00001,B00001,B00001};//top right
  39. byte cornerD[]={B00001,B00001,B00001,B00001,B00001,B00001,B00001,B11111};//btm right
  40. void flip(char *text);
  41. void setup() {
  42.   Serial.begin(9600);
  43.   lcd.begin(16,2); //
  44.   //flipped characters
  45. lcd.createChar(0,uA);
  46. lcd.createChar(1,uB);
  47. lcd.createChar(2,uC);
  48. lcd.createChar(3,uD);
  49. lcd.createChar(4,uE);
  50. lcd.createChar(5,uF);
  51. lcd.createChar(6,uG);
  52. lcd.createChar(7,uH);
  53. lcd.createChar(8,uI);
  54. lcd.createChar(9,uJ);
  55. lcd.createChar(10,uK);
  56. lcd.createChar(11,uL);
  57. lcd.createChar(12,uM);
  58. lcd.createChar(13,uN);
  59. lcd.createChar(14,uO);
  60. lcd.createChar(15,uP);
  61. //lcd.createChar(16,uQ);
  62. //lcd.createChar(17,uR);
  63. //lcd.createChar(18,uS);
  64. //lcd.createChar(19,uT);
  65. //lcd.createChar(20,uU);
  66. //lcd.createChar(21,uV);
  67. //lcd.createChar(22,uW);
  68. //lcd.createChar(23,uX);
  69. //lcd.createChar(24,uY);
  70. //lcd.createChar(25,uZ);
  71. //lcd.createChar(26,cornerA);
  72. //lcd.createChar(27,cornerB);
  73. //lcd.createChar(28,cornerC);
  74. //lcd.createChar(29,cornerD);
  75.  
  76.   //ascii coversion prolly like n+66
  77.   //setCursor be like: (column, row) 16 cols, 2 rows, both start at 0
  78.  
  79.  
  80.     text="WTF";
  81.  // lcd.setCursor(0,0);
  82. // flip(text); // lcd.write(1);
  83. }
  84.  
  85. void loop() {
  86. //lcd.setCursor(16,0);
  87.  
  88.   for (int i=0; i<16;i++){
  89.   lcd.write(i);
  90.   lcd.setCursor(i,0);
  91.  
  92.   delay (900);
  93.   }
  94.  
  95.  
  96.   }
  97.  
  98.  
  99. void flip(char *text){
  100.  
  101.   Serial.println(text);
  102.  char *tmp=atoi(text);
  103.  int i = strlen(tmp);
  104.  lcd.write(25);
  105.  Serial.println(tmp[1]);
  106.   }
Add Comment
Please, Sign In to add comment