文章链接
微信扫一扫分享
int val = 0; int ledPin = 13; void setup() { Serial.begin(9600); } void loop() { val = Serial.read(); if (-1 != val) { if ('A' == val || 'a' == val) { Serial.println("Hello from Arduino!"); }else if ('B' == val || 'b' == val) { digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); } } }复制代码
使用道具 举报
发表于 2012-11-27 17:47:35
发表于 2012-11-27 17:51:12
本版积分规则 回复 回帖并转播 回帖后跳转到最后一页
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed