【发布时间】:2021-11-24 12:57:39
【问题描述】:
所以我想通过 RX TX 从一个价值为 INT 的 Arduino 将传感器发送到另一个 Arduino。问题是我想用这个值打开另一个 Arduino 上的 LED。但是数字以 ASCII 块的形式出现,我想知道是否以及如何将数字转换为 INT。
这是发件人的代码
int i = 601;
int sensorValue = 0;
int input = A0;
void setup () {
Serial.begin (9600); // Begin serial communication with 9600 baud
sensorValue = analogRead (input); // here the sensor value is written into the variable "sensorValue"
Serial.println (sensorValue); // send from the variable "sensorValue" via the serial interface
}
void loop () {
}
【问题讨论】: