Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LCD.h>
- #include <LiquidCrystal_I2C.h>
- #define butl 3
- #define butp 5
- #define led 6
- LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7);
- int button = 0;
- int num;
- int nume;
- int state;
- void setup()
- {
- pinMode(butl,INPUT);
- pinMode(butp,INPUT);
- pinMode(led,OUTPUT);
- digitalWrite(butl,HIGH);
- digitalWrite(butp,HIGH);
- Serial.begin(9600);
- lcd.begin (16,2); // wyswietlacz 2x16
- lcd.setBacklightPin(3,POSITIVE);
- lcd.setBacklight(HIGH);
- lcd.clear();
- lcd.home();
- lcd.print("Technikum nr 1");
- }
- void loop()
- {
- bool butlst=digitalRead(butl);
- bool butpst=digitalRead(butp);
- button = 0;
- if (butlst == 0){
- button=1;
- }
- if (butpst == 0){
- button=2;
- }
- switch(button){
- case 1:
- num++;
- if(num>2){
- num=0;
- }
- break;
- case 2:
- nume++;
- if(nume>1){
- nume=0; }
- break;
- }
- switch(num){
- case 0:
- break;
- case 1:
- delay(250);
- break;
- case 2:
- delay(750);
- break;
- }
- switch(nume){
- case 0:
- lcd.scrollDisplayLeft();
- break;
- case 1:
- lcd.scrollDisplayRight();
- break;
- }
- delay(250);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement