Created
March 20, 2018 06:34
-
-
Save IdrisCytron/bea4d2576ffd56ec63eff9079a7afe83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
const int rs = 13, en = 12, d4 = 8, d5 = 9, d6 = 10, d7 =11; | |
LiquidCrystal lcd(rs, en, d4, d5, d6, d7); | |
#include <Servo.h> | |
Servo myservo; | |
int button1 = 2; | |
int button2 = 3; | |
int choice1 = 0; | |
int choice2 = 0; | |
void setup() | |
{ | |
lcd.begin (16,2); | |
myservo.attach(6); | |
pinMode(button1, INPUT_PULLUP); | |
pinMode(button2, INPUT_PULLUP); | |
} | |
void loop() | |
{ | |
myservo.write(180); | |
lcd.setCursor(0, 0); | |
lcd.print (" You Love Me?"); | |
lcd.setCursor(0, 1); | |
lcd.print(" YES NO "); | |
choice1 = digitalRead(button1); | |
choice2 = digitalRead(button2); | |
if (choice1 == LOW) { | |
for (int pos = 180; pos >= 75; pos -= 1) { | |
myservo.write(pos); | |
delay(15); | |
} | |
lcd.clear(); | |
lcd.print("I LOVE U too"); | |
delay(5000); | |
} | |
else if (choice2 == LOW) { | |
lcd.clear(); | |
lcd.setCursor(0, 0); | |
lcd.print("Thank you for"); | |
lcd.setCursor(0, 1); | |
lcd.print("being honest"); | |
delay(5000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment