Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(7,6,5,4,3,2);
- int i=0;
- char input[] = "a";
- const int dw = 8;
- const int ri = 9;
- const int le = 10;
- const int up = 11;
- const int ok = 12;
- const int mn = 13;
- int bdw=0, bri=0, ble=0, beu=0, beo=0, bem=0;
- void setup()
- {
- pinMode(dw, INPUT);
- pinMode(ri, INPUT);
- pinMode(le, INPUT);
- pinMode(up, INPUT);
- pinMode(ok, INPUT);
- pinMode(mn, INPUT);
- }
- void intext()
- {
- int lim=16;
- lcd.setCursor(0,1);
- lcd.print(input);
- for(i=0; i<lim ; )
- {
- lcd.setCursor(0,1);
- lcd.print(input);
- if(digitalRead(dw)==HIGH)
- {
- if(input[i]>'z')
- input[i]='a';
- input[i]=input[i]+1;
- delay(500);
- }
- if(digitalRead(up)==HIGH)
- {
- if(input[i]<'a')
- input[i]='z';
- input[i]=input[i]-1;
- delay(500);
- }
- if(digitalRead(ri)==HIGH)
- {
- delay(500);
- i=i+1;
- }
- if(digitalRead(le)==HIGH)
- {
- delay(500);
- i=i-1;
- }
- if(digitalRead(ok)==HIGH)
- {
- lim=i;
- delay(500);
- }
- }
- }
- void loop()
- {
- lcd.begin(16,2);
- lcd.setCursor(0,0);
- lcd.print("Type text:");
- intext();
- lcd.clear();
- lcd.setCursor(0,0);
- lcd.print("Success!!");
- lcd.setCursor(0,1);
- lcd.print(input);
- delay(5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement