Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sliderReading; //slider reading
- int phoReading; //photocell reading
- int frequency1;
- int frequency2;
- void setup() {
- Serial.begin(9600);
- pinMode(8, OUTPUT);
- }
- void loop() {
- //reading the light sensors
- sliderReading = analogRead(A0);
- phoReading = analogRead(A1);
- //mapping each frequency
- frequency1 = map(sliderReading, 1, 1023, 100, 500);
- frequency2 = map(phoReading, 1, 1023, 100, 500);
- //change the pitch, putting two frequencies together
- tone (8, frequency1 + frequency2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement