wiki:wade/embedded/arduino/example/example_2

Version 4 (modified by wade, 15 years ago) (diff)

--

回到 Arduino

發送端 sender:

/*
 * arduino 讀取 pin 5 這顆 sensor 資料,再寫入 serial
 */
#define sensorIn 5
int val = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  val = analogRead(sensorIn);
  Serial.println(val);
//  Serial.write("test\n");
  delay(100);
}

接收端 receiver:

tail -f /dev/ttyUSB0