Recently, I’ve trying to make sort of "light
control" on Arduino. I use Raspberry Pi to send the control message via
serial port (USB cable).
Here is the Arduino code:
void setup() { Serial.begin(9600); pinMode(whiteled,OUTPUT); } void loop() { if(Serial.available()>0) { char cmd = Serial.read(); if(cmd == 'a') { while(1) { Serial.print("data received = "); Serial.print(cmd); digitalWrite(whiteled,HIGH); delay(1000); digitalWrite(whiteled,LOW); } } } }
updating......
No comments :
Post a Comment