[英]arduino byte data type, use uint8_t or unsigned char in c?
I'm porting some Arduino code to a mcu in pure c. 我正在将一些Arduino代码移植到纯C语言的MCU中。
The data type byte
is used in the arduino code which is not supported by the compiler. 数据类型
byte
在arduino代码中使用,编译器不支持。 I'm wondering which data byte should I use uint8_t
or unsigned char
? 我想知道应该使用
uint8_t
还是unsigned char
哪个数据字节? Which is more correct? 哪个更正确? I'm relatively new to coding.
我是编码的新手。
I gather it depends what the intent of the variable. 我收集它取决于变量的意图。
The variable will store hex data from this camera (screen shot of output). 该变量将存储来自此摄像机的十六进制数据(输出的屏幕截图)。
byte incomingbyte;
void loop()
{
byte a[32];
int ii;
while(Serial2.available()>0)
{
incomingbyte=Serial2.read();
}
}
Many thanks 非常感谢
According to this link an arduino byte is an unsigned 8 bit value. 根据此链接 ,arduino字节是一个无符号的8位值。 I personally would use the more expressive
uint8_t
, but an unsigned char
would work as well. 我个人将使用更具表现力的
uint8_t
,但unsigned char
也可以使用。
What type is used on the new platform to return a byte received from the serial port? 在新平台上使用什么类型返回从串行端口接收的字节?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.