I'm having real problems trying to work this one out, so would be very grateful for any pointers.
I've hooked up 5 LDRs to one Arduino using a breadboard, and am sucessfully getting 5 seperate readings - one for each. They each trigger a seperate mp3 file to play when the reading drops below ambient-100 (hand placed over the LDR). The audio stops as soon as the hand is removed.
It works perfectly with 3 of the LDRs, but number 5 doesn't do anything at all when the light is blocked, and when a hand is placed over LDR 4 both it's own mp3 file, and the mp3 linked to LDR 5 play at the same time! I don't understand, as they're getting seperate readings from the photoresistors.
I've tried for hours to work out where the problem is stemming from, and am pretty sure that it's not the code. Oh, it would have been so easy if it was a typing mistake! lol
Does anyone have any ideas? ..... Please! (*desperation*)
void draw() { int photocellReading1 = arduino.analogRead(photocellPin1); int photocellReading2 = arduino.analogRead(photocellPin2); int photocellReading3 = arduino.analogRead(photocellPin3); int photocellReading4 = arduino.analogRead(photocellPin4); int photocellReading5 = arduino.analogRead(photocellPin5); int photocellReading6 = arduino2.analogRead(photocellPin1); int photocellReading7 = arduino2.analogRead(photocellPin2); int photocellReading8 = arduino2.analogRead(photocellPin3); int photocellReading9 = arduino2.analogRead(photocellPin4); int photocellReading10 = arduino2.analogRead(photocellPin5);
The mp3 starts playing when a hand is placed over the photoresistor, but it doesn't stop when the hand is removed. I've tried player.close(); in the void draw(), but it doesn't work. Does anyone have a solution ..... or any suggestions please?
I'll start of by saying that I'm pretty much a newbie when it comes to processing and arduino, so please excuse my lack of technical terms! But we've all got to start somewhere hey.
I do have some basic coding knowledge, and have done a few simple projects using the Arduino Environment, so hopefully I'll be able to get to grips with what I need to learn asap!
Basically (very basically .... although I can go into more detail if you need) I'm doing a project that will play audio files through a pc when a hand is placed over a photoresistor on the arduino. I want the sound to be triggered when there is very low light, and stop immediately when the hand is removed. I will have 8 photoresistors - each with a different sound file linked to it (these need to play simultaneously if two or more photoresistors are covered).
I've got the Arduino picking up the required information, but now need to sort the audio out. I've been told that processing and minim may be able to help, but am having problems getting started. I've managed to upload StandardFirmware to the Arduino, but am stuck after that. Could someone tell me what instruction number 4 means please?
Unzip the library and copy the "arduino" folder into the "libraries" sub-folder of your Processing Sketchbook. (You can find the location of your Sketchbook by opening the Processing Preferences. If you haven't made a "libraries" sub-folder, create one.)
Run Arduino, open the Examples > Firmata > StandardFirmata sketch, and upload it to the Arduino board.
In Processing, open one of the examples that comes with with the Arduino library.
Edit the example code to select the correct serial port.
Run the example.
As it stands I've tried opening Processing and have typed 'Arduino.list();', but I get a message saying 'Cannot find anything named "Arduino"'
Any suggestions would be very welcome :-)
I've searched (at length) online for a solution to my problem, but all of the tutorials assume a basic knowledge of processing etc ... which unfortunately I don't have. If I could get my head around how to set it up, and some of the core principles, I think I'd be ok!