Hello,
Apologies, newbie here. I'm having trouble implementing analogRead. Here's a chunk of code:
playfile(name);
while (wave.isplaying) {
volume = 0;
for (i=0; i<8; i++)
{
v2 = analogRead(1);
delay(5);
}
if (v2 > 440) //440
{
pulseWidth = 1800; //1800
mouthchange = 1;
}
else
{
pulseWidth = 800; //800
mouthchange = 1;
}
digitalWrite(servoPin, HIGH); // start the pulse
delayMicroseconds(pulseWidth); // pulse width
digitalWrite(servoPin, LOW); // stop the pulse
}
I've soldered a link of wire from R7 to Analog In 1 to (hopefully) read the volume in as a voltage change. I'm attempting to follow the following instructable:http://www.instructables.com/id/Talking-Arduino-Halloween-Skeleton/?ALLSTEPS
Any ideas what I'm doing wrong? I've isolated that all the hardware is good - uploaded the sample servo sweep sketch and the servo moves as expected.
Thanks, in advance, for your time.
-Ray