Tone pitch follower

This example is for Wiring version 0027+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know.

switch by BARRAGAN http://barraganstudio.com

Use a switch connected to digital pin 0. Digital pin o is used as input and connected to a switch When the switch is pressed, the Wiring board LED turn ON, the LED turns OFF when the switch is released.


int switchPin = 0;  // digital pin to attach the switch

void setup() 
{
  pinMode(switchPin, INPUT);  // set digital pin 0 as input
  pinMode(48, OUTPUT);    // set digital pin 48 (Wiring LED) as output
}

void loop() 
{
  if(digitalRead(switchPin) == HIGH)  // if the switch is pressed 
  {
      digitalWrite(48, HIGH);         // turns the Wiring LED ON
  }
  else                                // if the switch is not pressed
  {
    digitalWrite(48, LOW);            // turns the Wiring LED OFF
  }
}