Connect a small speaker to pin 8 and ground We will use the

Connect a small speaker to pin 8 and ground. We will use the speaker that produces a changing tone according to how far your hand is away from the LDR (a \"light Theramin\"). Connect your LDR circuit as on page one and your speaker as just described. The code below uses a 5 second period once the program is loaded to calibrate the system-to find what the max and min values the LDR detects according to the light intensity in the room. We\'ll use the built in LED on pin 13 to show this is happening. Type in the code and show your working Theramin to your instructor int sensorValue; int sensorLow = 1023; int sensorHigh = 0; const int ledPin = 13; void setup() {//turn on LED to signal start of calibration phase pinMode(ledPin, OUTPUT); digitalWrite(ledPin; HIGH);//calibrate during initial 5 second period while (millisQ sensorHigh) {sensorHigh = sensorValue;}//record min sensor value if (sensorValue

Solution

In 5 seconds, First it reads the A0 values and compares with sensor high and low values to get the maximum and minimum values for LDR. It is helpful to estimate the light intensity of the room.

 Connect a small speaker to pin 8 and ground. We will use the speaker that produces a changing tone according to how far your hand is away from the LDR (a \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site