





| Arduino入門好簡單-語法篇(SerialRead) |
| 站長Blog文章單元 - 入門教學(連接小電阻,光敏,五分鐘搞定的) | |
| 作者是 ken | |
| 週一, 13 九月 2010 00:41 | |
|
int incomingByte = 0; // for incoming serial data void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
|
|
| 最近更新在 週二, 13 九月 2011 01:19 |