Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- int pin_LCD_DATA[8] = {A8,A9,A10,A11,A12,A13,A14,A15};
- int pin_LCD_CTRL[3] = {A5,A6,A7};
- LiquidCrystal lcd(A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15);
- int sw[6] = {20,22,24,26,28,30}; // Switch
- void setup() {
- lcd.begin(16,2);
- pinMode(sw,INPUT_PULLUP);
- }
- void loop() {
- boolean pw = false;
- int w=0 , h=0;
- while(1){
- lcd.clear();
- if(digitalRead(sw[1]) == HIGH) {w=0;delay(100);} //UP
- if(digitalRead(sw[2]) == HIGH) {w=1;delay(100);} //DOWN
- if(digitalRead(sw[3]) == HIGH) {if(h<=0){continue;}h--;delay(100);} //LEFT
- if(digitalRead(sw[4]) == HIGH) {if(h>=15){continue;}h++;delay(100);} //RIGHT
- lcd.setCursor(h,w);
- lcd.print("*");
- delay(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement