reading voltage from analog pin

Your source for all things Atmel.

Moderator: phalanx

Post Reply
keithg
Posts: 16
Joined: Fri Apr 10, 2009 6:07 am
Location: FL

reading voltage from analog pin

Post by keithg » Sat Oct 03, 2009 2:02 pm

I have tested an LM386 circuit with multimeter and a small speaker so I know it is functional but I can't read meaningful values with this code

Code: Select all

void setup() {
   Serial.begin(9600);
}

void loop() {
  
  int soundLevel =  analogRead(0) -512;
  
  Serial.print( "soundIn = ");
  Serial.println(soundLevel);
 delay (1000);
}

I would appreciate advise.  Thanks.

Liencouer
Posts: 155
Joined: Fri Mar 28, 2008 7:36 am

Post by Liencouer » Tue Oct 06, 2009 6:49 am

What are you trying to accomplish? How is the speaker/audio amp related to the analog input? What do you have hooked up to analog pin 0?

Post Reply