Tuesday, October 6, 2009

Andrew Zahn CODE 1.

int buttonpin = 2;
int potpin = 0;
int buttonvalue = 0;
int potvalue = 0;
int ledPin = 13;

void setup(){
  pinMode(buttonpin, INPUT);
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}



void loop(){
  potvalue = analogRead(potpin);
  buttonvalue = digitalRead(buttonpin);
  
  Serial.println(buttonvalue);
  Serial.println(potvalue);
  if (buttonvalue == HIGH){
    digitalWrite(ledPin, HIGH);
    delay(potvalue);
    digitalWrite(ledPin, LOW);
    delay(potvalue);
  }
  delay(100);
}


No comments:

Post a Comment