A quick tutorial on how to use the tilt sensor.
Code includes Arduino conditional operators.
Tilt sensor used in this video: SW-520D
Projects in this video:
Tilt Sensor Value - display 1 and 0 on the Serial Monitor
Tilt Sensor With 1 LED - Turn on/off an LED using the tilt sensor
Tilt Sensor With 2 LEDs - Turn on/off 2 LEDs using 2 tilt sensors
Download the code here:
https://www.arduinointro.com/articles/projects/tilt-sensor-with-arduino-easy-tutorial