Home - STJRush/CS5th_G5 GitHub Wiki
Group Members : Oskar , Sean , Michael
Firstly we made a code that turned on an LED. To do this we wired the LED to output 5 on the BCM. We then included a sleep to keep it on for 2 seconds. Secondly we made a code for the sensor. We used a while true and an if , elif. If the IR sensor =1 it printed "theres something in my way". Elif the senor =0 it printed "theres nothing in my way". We soon found out these were backwards so we swapped the 1 and the 0. Thirdly we created a buzzer code , this code turned on the buzzer for 9 seconds. Finally we used all these codes and merged them into 1 large code. This code made the buzzer go off if there was nothing in the sensors way (the LED turned on). If there was something in the sensors way the LED stayed off and buzzer stayed off.
We planned on having the LED on if the item is still there but this wasnt convenient as since the code was in a loop we had to use CTRL+C to exit the loop. The problem was that if the object was still there the LED would be on and if we used CTRL+C to exit the loop, the LED would stay on. While if the object was taken away the buzzer would turn on and when we used CTRL+C the buzzer would stay on.
Here are some photos:
CODE WITHOUT LED
WIRING OF ONLY BUZZER AND SENSOR
FLOWCHART WITHOUT LED
WIRING OF BUZZER , LED AND SENSOR
CODE WITH LED , BUZZER AND SENSOR
FLOWCHART WITH BUZZER , LED AND SENSOR