Programming in C Write a program in Arduino Instrument of Li

Programming in C. Write a program in Arduino.

Instrument of Light:

Create a program which turns your Arduino into a light based electronic instrument. The program should play music based on the amount of light hitting the optical sensor. There should be a way to capture particularly pleasing tones and play those tones back in the order they are captured.

The program MUST utilize the following :

• An array to hold the stored tones

• A function : void read_buttons( int *sw1, int *sw2, int *sw3, int *sw4) to read and store the state of the four buttons on the board

• A function playback( notes[] ) which plays back the notes stored

• A function clear_playlist( *notes) which clears the stored tones

• A function tone_value() which generates a tone based on the current state of the optical sensor

• The possible tones should span the range of human hearing

Solution

A photoresistor is a special component whose resistance fluctuates based on visible light. Depending on your environment, a photoresistor may be able to sense fluctuations caused by movements as far as a few feet away.

Connecting one photoresistor to the Arduino Uno

I recommend the Arduino Playground tutorial for this sensor. Here are their instructions:

Connect the photoresistor one leg to pin 0, and pin to +5V
Connect a resistor (around 10k is a good value, higher values gives higher readings) from pin 0 to GND. (see appendix of arduino notebook page 37 for schematics).

From there, I highly recommend running their test code:

Programming in C. Write a program in Arduino. Instrument of Light: Create a program which turns your Arduino into a light based electronic instrument. The progr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site