
Location of 'Analog In' pins is indicated by highlight.
I’ve got an Arduino Diecimila board that I’m using for a project. It’s has a handy ATMEL microcontroller and a few bells and whistles. One of my project requires the usage of sound sensors which are feed into the Arduino Analog In pins. See the image attached to this post.
Here is an example of Arduino Code, that sends the Analog Read to the Serial Port
// Metronome for Serial Communication
unsigned long previousMillis = 0;
void setup() {
Serial.begin(1000000); // Initiate Serial Communication
}
void loop() {
// [1] SEND ANALOG DATA VIA SERIAL
// CHECK TIME INSTEAD OF USING DELAY
if ( millis() - previousMillis > 33 ) {
previousMillis = millis();
// SEND ANALOG DATA FROM PIN 0 - 5, INCLUSIVE, USING A LOOP
for ( byte i = 0; i < 5; i++) {
Serial.print( analogRead(i) );
Serial.print(' ');
}
// INDICATE CONCLUSION OF DATA, ASCII CARRIAGE RETURN VALUE
Serial.println(10);
}
}
[...] Sometimes you need to test the Analog values that you are receiving from the Arduino Board. It’s good to have a sketch that plots the values for you. I’ve written this sketch so that it adjust for the screen height and width. The Arduino code to get the Analog Values can be found here. [...]