This video is about how to use the Tilt switch on Arduino. #Arduinio #arduinouno #robotics #programming.
You can Visit us at: www.wizardofwestla.com
Facebook: @wizardofwestla
Here is the code you can also copy and paste:
const int ledPin = 13;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
pinMode(2, INPUT);
digitalWrite(2, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
int digitalVal = digitalRead(2);
if (HIGH == digitalVal)
{
digitalWrite(ledPin, LOW); // turn off the LED
}
else
{
digitalWrite(ledPin, HIGH); // turn on the LED
}
}
...
https://www.youtube.com/watch?v=MLGq4O9KbCA