Sketches

HERE you will find all 8 sketches from “Arduino Adventures: Escape From Gemini Station”

2 thoughts on “Sketches

  1. Anon

    /* The story implies that Cade was wearing multiple “torches” this sketch allows him to switch
    them on without having to hold down multiple buttons all over his body, kids spot things like this…*/
    int buttonPin = 12; // Arduino pin that the button is connected to.
    int LEDPin = 6; // Arduino pin that the LED is connected to.

    boolean buttonState = false; // current state of the button
    boolean lastButtonState = false; // previous state of the button
    boolean LampState = false; // previous state of the button
    void setup()
    {
    // Set button as an input
    pinMode(buttonPin, INPUT);
    // Set LED as an output
    pinMode(LEDPin, OUTPUT);
    // Use Arduinos internal pull-up resistor
    digitalWrite(buttonPin, HIGH);
    }
    void loop()
    {
    // Read button value on Arduino
    buttonState = digitalRead(buttonPin);
    // Conditional If Statement
    if(buttonState != lastButtonState && buttonState == false)
    {
    LampState = !LampState;
    }
    if(LampState == true)
    {
    // Turn ON LED when button is pressed
    digitalWrite(LEDPin, HIGH);
    }
    else
    // Turn OFF LED when LampState is false
    digitalWrite(LEDPin, LOW);

    // save the current state as the last state,
    //for next time through the loop
    lastButtonState = buttonState;
    }

    Reply
  2. Harold Timmis Post author

    Hey Anon I am going to do another sketch where it will allow the kids or adults to update their hardware and software to have multiple LEDs run with just 1 push button. Thank you for you comment.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s