Arduino Code
int buttonPin = 3;
int buttonState = 0;
void setup(){
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}
void loop(){
buttonState = digitalRead(buttonPin);
switch(buttonState){
case HIGH:
Serial.println("off");
break;
case LOW:
Serial.println("on");
analogWrite(9, 123);
delay(100);
analogWrite(9,0);
break;
}
delay(100);
}
int buttonState = 0;
void setup(){
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}
void loop(){
buttonState = digitalRead(buttonPin);
switch(buttonState){
case HIGH:
Serial.println("off");
break;
case LOW:
Serial.println("on");
analogWrite(9, 123);
delay(100);
analogWrite(9,0);
break;
}
delay(100);
}
No comments:
Post a Comment