Advertisement
waterforce1205

Untitled

Aug 21st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function setup() {
  2.     // Initiate the serial communication.
  3.     Serial.begin(9600);
  4. }
  5.  
  6. function loop() {
  7.     // Get the value of the light sensor
  8.     sensorValue = <Read value at A0>;
  9.     // Change the tone frequency according to sensorValue
  10.     tone(pin = 9, frequency = (1000 - sensorValue) + 800, duration = 1 second);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement