week5_ultrasonic&photocellControlledLed

After learning about sensors, we were asked to combine the use of both photocell – love – and ultrasonic sensor using an if statement, and here is the result:

so whenever an object is closer than 20 cm and the room is dark a light should be turned on  TEST .

components: Ultrasonic sensor, photocell, LED, 1K resistor, wires and Arduino (I did not use a resistor for my LED because it was huge and it did not require one but in your case, you might need 200 Ohm )

code: https://github.com/alyalqarni/sensingTheWorld/commit/b92b3e0172ae92ecccc605d720d7dc5ff6a84060

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *