Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "MeMCore.h"
- #include "Adafruit_LiquidCrystal.h"
- MeJoystick joystick(PORT_4);
- Adafruit_LiquidCrystal lcd(0);
- int x=0,y=0,pin1=11,pin2=12;
- void inchide(){
- digitalWrite(pin1,HIGH);
- digitalWrite(pin2,LOW);
- }
- void deschide(){
- digitalWrite(pin1,LOW);
- digitalWrite(pin2,HIGH);
- }
- void stai(){
- digitalWrite(pin1,LOW);
- digitalWrite(pin2,LOW);
- }
- void setup() {
- Serial.begin(9600);
- pinMode(pin1,OUTPUT);
- pinMode(pin2,OUTPUT);
- lcd.begin(16, 2);
- lcd.setBacklight(HIGH);
- lcd.print("Mod:");
- }
- void loop() {
- x = joystick.readX();
- y = joystick.readY();
- if(y>200){
- deschide();
- lcd.clear();
- lcd.print("Mod:");
- lcd.setCursor(5,0);
- lcd.print("open");
- lcd.setCursor(12,0);
- lcd.print("* *");
- lcd.setCursor(13,1);
- lcd.print("^");
- }
- else{
- if(y<-200){
- inchide();
- lcd.clear();
- lcd.print("Mod:");
- lcd.setCursor(5,0);
- lcd.print("close");
- lcd.setCursor(12,0);
- lcd.print("* -");
- lcd.setCursor(13,1);
- lcd.print("^");
- }
- else{
- stai();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement