Advertisement
Guest User

Untitled

a guest
May 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include "MeMCore.h"
  2. #include "Adafruit_LiquidCrystal.h"
  3.  
  4. MeJoystick joystick(PORT_4);
  5. Adafruit_LiquidCrystal lcd(0);
  6.  
  7. int x=0,y=0,pin1=11,pin2=12;
  8.  
  9. void inchide(){
  10. digitalWrite(pin1,HIGH);
  11. digitalWrite(pin2,LOW);
  12. }
  13.  
  14. void deschide(){
  15. digitalWrite(pin1,LOW);
  16. digitalWrite(pin2,HIGH);
  17. }
  18.  
  19. void stai(){
  20. digitalWrite(pin1,LOW);
  21. digitalWrite(pin2,LOW);
  22. }
  23.  
  24. void setup() {
  25. Serial.begin(9600);
  26. pinMode(pin1,OUTPUT);
  27. pinMode(pin2,OUTPUT);
  28. lcd.begin(16, 2);
  29. lcd.setBacklight(HIGH);
  30. lcd.print("Mod:");
  31.  
  32. }
  33.  
  34. void loop() {
  35. x = joystick.readX();
  36. y = joystick.readY();
  37. if(y>200){
  38. deschide();
  39. lcd.clear();
  40. lcd.print("Mod:");
  41. lcd.setCursor(5,0);
  42. lcd.print("open");
  43. lcd.setCursor(12,0);
  44. lcd.print("* *");
  45. lcd.setCursor(13,1);
  46. lcd.print("^");
  47. }
  48. else{
  49. if(y<-200){
  50. inchide();
  51. lcd.clear();
  52. lcd.print("Mod:");
  53. lcd.setCursor(5,0);
  54. lcd.print("close");
  55. lcd.setCursor(12,0);
  56. lcd.print("* -");
  57. lcd.setCursor(13,1);
  58. lcd.print("^");
  59. }
  60. else{
  61. stai();
  62. }
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement