Posts

  • Journey and Rhythms
    Sunday, December 13, 2009

Events

Deadlines

  • I have no upcoming deadlines worth mentioning. Other then some grad school bills.

Projects

  • I'm working on some top secret projects. Can't talk about them.
Location of 'Analog In' pins is indicated by highlight.

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);
  }
}
blog comments powered by Disqus