g1e-003a.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x3F,20,4); void setup() { lcd.init(); lcd.clear(); lcd.backlight(); // lcd.noBacklight(); lcd.setCursor(7,0); lcd.print("LCD2004"); lcd.setCursor(9,1); lcd.print("I2C"); lcd.setCursor(0,2); lcd.print("--------------------"); lcd.setCursor(3,3); lcd.print("G1 Electronics"); } void loop() { } |
[collapse]
g1e-002a.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include <LCD5110_Basic.h> LCD5110 myGLCD(2,3,4,6,5); extern uint8_t SmallFont[]; void setup() { myGLCD.InitLCD(60); myGLCD.clrScr(); myGLCD.setFont(SmallFont); myGLCD.print("G1", CENTER, 15); myGLCD.print("Electronics", CENTER, 25); } void loop() { } |
[collapse]
g1e-002b.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include #include #include Adafruit_PCD8544 display = Adafruit_PCD8544(2, 3, 4, 5, 6); void setup() { display.begin(); display.setContrast(50); display.clearDisplay(); display.setTextSize(2); display.setTextColor(BLACK); display.setCursor(35,10); display.println(«G1″); display.setTextSize(1); display.setTextColor(BLACK); display.println(» Electronics»); display.display(); } void loop() { } |
[collapse]
g1e-002c.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
#include #include #include Adafruit_PCD8544 display = Adafruit_PCD8544(2, 3, 4, 5, 6); void setup() { display.begin(); display.setContrast(50); display.clearDisplay(); } void loop() { display.clearDisplay(); display.setTextSize(2); display.setTextColor(BLACK); display.setCursor(20,10); display.println(analogRead(A0)); display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(40,25); display.println(» value»); display.display(); delay(500); } |
[collapse]
g1e-002d.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#include #include #include Adafruit_PCD8544 display = Adafruit_PCD8544(2, 3, 4, 5, 6); void setup() { display.begin(); display.setContrast(50); display.clearDisplay(); } byte LCD_Key () { int lcd_key_pr = analogRead(A0); if (lcd_key_pr > 884) return 0; //Button none 1023 if (lcd_key_pr < 71) return 1; //Button Left 0 if (lcd_key_pr < 236) return 2; //Button Press 143 if (lcd_key_pr < 419) return 3; //Button Down 330 if (lcd_key_pr < 626) return 4; //Button Right 508 if (lcd_key_pr < 884) return 5; //Button Up 745 } void loop() { display.clearDisplay(); display.setTextSize(2); display.setTextColor(BLACK); display.setCursor(20,10); switch (LCD_Key()) { case 0: display.println(«none»); break; case 1: display.println(«Left»); break; case 2: display.println(«Press»); break; case 3: display.println(«Down»); break; case 4: display.println(«Right»); break; case 5: display.println(«Up»); break; } display.display(); delay(500); } |
[collapse]
g1e-001a.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include <LiquidCrystal.h> LiquidCrystal lcd(8,9,4,5,6,7); void setup() { lcd.begin(16, 2); lcd.print("hello, world!"); analogWrite(10,50); } void loop() { lcd.setCursor(0,1); lcd.print(millis() / 1000); } |
[collapse]
g1e-001b.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include <LiquidCrystal.h> LiquidCrystal lcd(8,9,4,5,6,7); void setup() { lcd.begin(16, 2); analogWrite(10,50); } void loop() { lcd.clear(); lcd.setCursor(0,0); lcd.print("analogRead A0"); lcd.setCursor(0,1); lcd.print(analogRead(0)); delay(500); } |
[collapse]
g1e-001c.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#include <LiquidCrystal.h> LiquidCrystal lcd(8,9,4,5,6,7); void setup() { lcd.begin(16, 2); analogWrite(10,50); lcd.setCursor(0,0); lcd.print("Enter Button:"); } byte LCD_Key () { int lcd_key_pr = analogRead(0); if (lcd_key_pr > 940) return 0; //Button none 1023 if (lcd_key_pr < 65) return 1; //Button Right 0 if (lcd_key_pr < 219) return 2; //Button Up 131 if (lcd_key_pr < 394) return 3; //Button Down 307 if (lcd_key_pr < 601) return 4; //Button Left 481 if (lcd_key_pr < 940) return 5; //Button Select 722 } void loop() { lcd.setCursor(0,1); switch (LCD_Key()) { case 0: lcd.print("none "); break; case 1: lcd.print("Right "); break; case 2: lcd.print("Up "); break; case 3: lcd.print("Down "); break; case 4: lcd.print("Left "); break; case 5: lcd.print("Select"); break; } } |
[collapse]