In this exercise, you will use the pressure sensor to make a car counter that will control traffic flow. When a certain number of cars has passed, the stoplight (RGB LED) will turn red. After a few seconds, the stoplight will turn green and continue counting. The number of cars will be set by the Central Yún .
Materials:
- Arduino Yún
- Jumper wires
- 10k resistors (The colors on it are brown , black, orange and gold)
- Pressure sensor
- Breadboard
- Construct the MDF parts to hold the pressure sensor.
- Open “e5_carcounter” from the examples.
- Upload the sketch to the Yún.
- When the onboard LED L13 is on, the Yún is ready.
- Open the Serial Monitor and test the sensor by rolling something over it (remember that 1 car hits the sensor twice with its front and back wheels). Check the Central Yún ’s serial monitor to see all the saved values.
- Go to this URL: http://verkstad.cc/iot/mmx/2/index.php to see current state of the car counter signal.