Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Arduino Tilt Switch Led Blink Schematic + Code
  • Xin
    Posts: 3,251
    http://i.imgur.com/TMOvK.png
    http://i.imgur.com/XU62e.png
    int buttonpin = 2;
    int buttonstate = 0;
    int led1 = 12;
    void setup() {
    pinMode(led1, OUTPUT);
    pinMode(buttonpin, INPUT);
    }

    void loop() {
    buttonstate = digitalRead(buttonpin);
    Serial.println(digitalRead(buttonpin));
    if (buttonstate == HIGH) {
    digitalWrite(led1, HIGH);

    }
    else {
    digitalWrite(led1, LOW);

    }
    }
    Xin
  • Sh3llc0d3
    Posts: 1,910
    Nice to see you making use of fritzing for ths schematics :)