小编Joe*_*Joe的帖子

使用Arduino将serial.read()转换为可用的字符串?

我正在使用两个Arduinos使用newsoftserial和RF收发器相互发送纯文本字符串.

每个字符串的长度可能是20-30个字符.如何转换Serial.read()为字符串,以便我可以做if x == "testing statements"等等?

arduino

68
推荐指数
5
解决办法
33万
查看次数

将数值范围映射到另一个

数学从来不是我在学校的强项:(

int input_start = 0; // The lowest number of the range input.
int input_end = 254; // The lowest number of the range input.
int output_start = 500; // The lowest number of the range output.
int output_end = 5500; // The largest number of the range ouput.

int input = 127; // Input value.
int output = 0;
Run Code Online (Sandbox Code Playgroud)

如何将输入值转换为该范围的相应输出值?

例如,输入值"0"将等于输出值"500",输入值"254"将等于输出值"5500".如果输入值为50或101,我无法弄清楚如何计算输出值.

我确定这很简单,我现在想不到:)

编辑:我只需要整数,没有分数或任何东西.

c math arduino

58
推荐指数
6
解决办法
6万
查看次数

在Arduino上将整数/小数转换为十六进制?

如何将整数或十进制变量转换为十六进制字符串?我可以做相反的事情(将十六进制转换为int),但我无法弄清楚其他方式.

这适用Serial.print()于数组中的十六进制值.

arduino

6
推荐指数
2
解决办法
9万
查看次数

标签 统计

arduino ×3

c ×1

math ×1