Is it possible to have multiple light sensors with each one programmed to play a specific note/frequency when it is covered, meaning to play a note when there is no light.
For my senior project at college I want to make a sort of music instrument that has several light sensors that when a sensor is covered with a hand will play a specific note and when no hand is over it will stop playing the note.
I would use either the Arduino Uno or Arduino Mega. The Uno will give me only 6 analog inputs which will be ok, but I would like to have at least eight and if possible (and if time allows) to have at the most 16.
I have been searching for coding that does this, but have not found any yet. On this forum I found the closest I have found so far is the Lilypad Star Wars Coat (How to stop program as soon as sensor conditions met? - Sensors - Arduino Forum) which plays a song when light hits the sensor. I need the opposite of this, multiple sensors, and only one note per played per sensor.
My first assignment is to submit a proposal to my professor for the project. So I don't want to put alot time into searching for coding if this is not even possible or will take alot of time. We have two months to complete the project, but my proposal is due Sunday night.
Is it possible to have multiple light sensors with each one programmed to play a specific note/frequency when it is covered
Having multiple light sensors is not the problem. It is the "play a specific note" that is. Each tone that you want to play needs a timer. There are only 5 timers on a Mega, and one of them is used for millis() and other time-related activities.
The Uno will give me only 6 analog inputs which will be ok, but I would like to have at least eight and if possible (and if time allows) to have at the most 16.
Do you need analogue inputs when the covered/uncovered state is essentially a binary one ?
What should happen if more than one sensor is covered ?
PaulS:
Each tone that you want to play needs a timer. There are only 5 timers on a Mega, and one of them is used for millis() and other time-related activities.
Why is a timer needed? Couldn't the sketch be written to play the tone as long as the sensor was covered?
I have not worked with the Mega, just the Uno and Lilypad Mainboard (I used the sensor code that is mentioned in the Sew Electric[ book which I downloaded from the web site for the book. I made a Sound Game - https://www.youtube.com/watch?v=2kKUFl17_Sw).
I don't understand what you mean that covered/uncovered state is binary.
What I meant was that the the sensor output will be either above or below some value depending wjether it is covered or not. If that is the case, and depending on the value of the sensor output, then it may be possible to use digital inputs to detect the on/off state.
If more than one sensor is covered, then I would think that two notes/tones would be played.
You will find that difficult using the Arduino alone.