processing
// Serial Output + debug
int ledPin = 48;
int switchpin = 0; // switch connected to pin 0
void setup() {
pinMode(switchpin, INPUT); // pin 0 as INPUT
pinMode(ledPin, OUTPUT);
Serial.begin(9600); // start serial communication at 9600bps
}
void loop() {
digitalWrite(ledPin, HIGH);
Serial.print(1); // send 1 to Processing
delay(500);
digitalWrite(ledPin, LOW);
Serial.print(0); // otherwise send 0 to Processing
delay(300);
/* delay(200);
digitalWrite(ledPin, LOW);
delay(200);
if(digitalRead(switchpin) == HIGH) // if switch is ON
{
digitalWrite(ledPin, HIGH);
Serial.print(1); // send 1 to Processing
}else{
digitalWrite(ledPin, LOW);
Serial.print(0); // otherwise send 0 to Processing
}
delay(100); // wait 100ms
*/
}
'Hardware' 카테고리의 다른 글
smd toast oven (0) | 2008.03.24 |
---|---|
Wiring board + 가속도 센서 시리얼 통신 테스트 (0) | 2007.01.03 |
soldering (0) | 2006.12.14 |
hardware term (0) | 2006.02.21 |
자이레이션 (0) | 2006.01.22 |