SHOW:
|
|
- or go back to the newest paste.
1 | function setup() { | |
2 | // Initiate the serial communication. | |
3 | - | // Set the amount of bits transmitted per second to 9600. |
3 | + | Serial.begin(9600); |
4 | - | Serial.begin(9600) |
4 | + | |
5 | ||
6 | function loop() { | |
7 | // Get the value of the light sensor | |
8 | - | // Get the value of the light sensor at pin A0 |
8 | + | sensorValue = <Read value at A0>; |
9 | - | // using analogRead(A0) |
9 | + | // Change the tone frequency according to sensorValue |
10 | - | sensorValue = <Read from A0>; |
10 | + | tone(pin = 9, frequency = (1000 - sensorValue) + 800, duration = 1 second); |
11 | - | // Send the value to Serial Monitor |
11 | + |