LAB 12 Arduino programming part 2
In this lab, I read about the photo register and wrote a program that read values. This lab was also hard so I needed extra time to figure out all the lab questions besides lab time.
I connected the 10k register between the ground and one end of the photo register. I used 330ohm, and 10kohm in this circuit, the minimum and maximum range of values was 50~610 when I turned on the flash.
I used the map function that I learned in the lecture to complete this task, the minimum and maximum range of values was 50~610, and I used the map function to turn that into 0~100.
photo register code and circuit
After that, I wired the piezo buzzer and tested the code that was given and finally, I combined the photo register and piezo buzzer and created a single program. I had to use if statements to figure out this question(if it is dark or a button is pressed, turn on the LED AND play a tune. Else, turn the LED off) I had to define if is dark in Arduino, I set up the value of darkness 200. It means Arduino will recognize the dark if is under 200.
Comments
Post a Comment