Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- // initialize the library with the numbers of the interface pins
- LiquidCrystal lcd (4, 6, 10, 11, 12, 13);
- const int tiltPin= 7;
- int newTilt; // variable to read the tilt
- int oldTilt;
- void setup() {
- // set up the number of columns and ros on the LCD
- lcd.begin (16,2);
- lcd.setCursor (5,0);
- lcd.print ("This is your future");
- // set the cursor to column o, line 1
- //line 1 is the second row, since counting begins with 0
- lcd.setCursor (1,1) ;
- //print to the second line
- lcd.print ("......Ask me");
- Serial.begin(9600);
- }
- void loop() {
- newTilt = digitalRead (tiltPin);
- Serial.println (newTilt) ;
- if (newTilt != oldTilt) //making sure that we have moved the board
- {
- int randomcito = random (1,9);
- lcd.clear ();
- lcd.setCursor (2,0);
- lcd.print ("My guess is...");
- lcd.setCursor (2,1);
- switch (randomcito)
- {
- case 1:
- lcd.print (" yes ");
- break;
- case 2:
- lcd.print (" most likely ");
- break;
- case 3:
- lcd.print (" nope ");
- break;
- case 4:
- lcd.print (" HAHAHA ");
- break;
- case 5:
- lcd.print (" you wish ");
- break;
- case 6:
- lcd.print (" certainly ");
- break;
- case 7:
- lcd.print (" you will fail ");
- break;
- case 8:
- lcd.print (" who knows? ");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement