Created
April 22, 2018 18:19
-
-
Save slendidev/213ad9bb21faf9968b1388b1e29c2629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 16, 2); | |
int buttonState = 0; | |
int program = 1; | |
int programs = 1; | |
int a = 1; | |
byte man_1[8] = { | |
0x01, | |
0x05, | |
0x0E, | |
0x14, | |
0x14, | |
0x04, | |
0x0A, | |
0x0A | |
}; | |
byte man_2[] = { | |
0x02, | |
0x05, | |
0x0E, | |
0x14, | |
0x14, | |
0x04, | |
0x0A, | |
0x0A | |
}; | |
void setup() { | |
pinMode(2, INPUT); | |
Serial.begin(9600); | |
lcd.begin(); | |
lcd.createChar(1, man_1); | |
lcd.createChar(2, man_2); | |
lcd.home(); | |
lcd.backlight(); | |
} | |
void loop() { | |
buttonState = digitalRead(2); | |
if (buttonState == HIGH) { | |
if (program > programs) { | |
program = 1; | |
} else { | |
program++; | |
} | |
} | |
switch (program){ | |
case 1: | |
if (a == 1) { | |
a = 2; | |
lcd.print("Hello, world! "); | |
lcd.write(2); | |
} else { | |
a = 1; | |
lcd.print("Hello, world! "); | |
lcd.write(1); | |
} | |
delay(600); | |
lcd.clear(); | |
default: | |
Serial.print(""); | |
} | |
lcd.setCursor(0,1); | |
lcd.print("Program nr: "); | |
lcd.print(program); | |
lcd.print("/"); | |
lcd.print(programs); | |
lcd.setCursor(0,0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment