top of page
Light Mapped to Tone Code

​int lowValue = 0;  //change this number to the lowest value you observed in the last sketch
int highValue = 1023;  //change this number to the highest value you observed in the last sketch

void setup() {
Serial.begin(9600);  
// open serial monitor port
}

void loop() {
int lightValue = analogRead(A0);  
// reads light intensity
int pitch = map(lightValue, lowValue, highValue, 50, 4000);  // maps the light values to a pitch
tone (8, pitch, 15);  // play the tone on pin 8 for 15 ms
delay(10);        // delay in between reads for stability
}

Igniting Innovation through Functional Prototyping and Physical Computing

Contact Information

odysseyboardedu.@gmail.com
Phone: (360) 303-5526
24338 Lee Road
Mount Vernon, WA 98274

Contact Us

Thanks for submitting!

© 2017 by Odyssey Board. All rights reserved.

bottom of page