Mission 19 - Fortune Teller
 DuinoKit Essentials - View Only. See new "Mission Manual" forum for manual and code   Started by Daniel Alich   2017-06-27 21:22:06 -04:00   Comments: 1    Viewed: 775

  1. Daniel Alich
    Daniel Alich Member Staff Member
    252_1511884574_Mission 19 - Fortune Tell

    /*
    Program written for DuinoKit

    Wiring guide:

    NANO D2 -> LCD D7
    NANO D3 -> LCD D6
    NANO D4 -> LCD D4
    NANO D5 -> LCD D4
    NANO D11 -> LCD E
    NANO D12 -> LCD RS
    LCD GND -> LCD R/W -> LCD -LED -> NANO GND
    NANO D13 -> Button (right)
    Button (left) -> NANO GND

    */

    #include <LiquidCrystal.h>

    //LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    // ( RS, E, D4, D5, D6, D7)

    LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
    // ( RS, E, D4, D5, D6, D7)

    void setup() {
    lcd.begin(16, 2);
    digitalWrite(13,HIGH); // Use the internal pull-up resistor
    ClearName();

    randomSeed(analogRead(0));
    }

    void loop() {

    if(digitalRead(13) == LOW) {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("The Answer is: ");
    lcd.setCursor(0, 1);

    String words1[] = {
    "Yes, Go for it!", "Deny it Happened", "Forget it!", "Maybe", "No", "Never Again" , "Ask Later", "Don't Tell Anyone", "Keep Dreaming", "Most Certainly", "Uh huh!", "I'll never tell." , "", "", "", "", "", "" , "", "", "", "" };

    int amount = 12; //Amount of items in the array
    delay(1000);
    lcd.print(words1[random(0, amount)]);
    delay(4000);
    ClearName();
    }
    }

    void ClearName() {
    lcd.clear();
    lcd.print(" DuinoKit");
    digitalWrite(6,HIGH);
    lcd.setCursor(0, 1);
    lcd.print(" Fortune Teller");
    digitalWrite(6,HIGH);
    }

    Daniel Alich, 2017-06-27 21:22:06 -04:00
  2. (You must log in or sign up to post here)

Report Post

Write your reason

Log in | Sign up
Terms & Conditions!
Help!