钻石会员
主题
帖子
积分12502
阅读权限50
注册时间2010-4-10
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2014-11-17 16:45
|
显示全部楼层
一楼有写着:Arduino程序为例程里加了50ms的延时;
发送数据格式为:ASCII码+换行回车符,例如发送1.53V,则发送HEX数据:31 2E 35 33 0D 0A
时间过去久了,没找到当时的程序。
可以参考:
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(50); // delay in between reads for stability
}
|
|