【发布时间】:2017-08-30 09:43:49
【问题描述】:
我想在 uint8_t 中将 HEX 字符的关系硬编码存储为一个数组,例如在 php 中 a 会做类似的事情
$relation = [
'uint8here-justasample',
'uint8here-justasample',
'uint8here-justasample',
'uint8here-justasample',
'uint8here-justasample'
];
如何在 Arduino 中做到这一点?
这是 uint8_t 数组,将存储在 uint8 的数组中
uint8_t event[8] = {'0','0','0','0','7','0','1','5'};
【问题讨论】:
-
您想要一种将十六进制指定值存储在数组中的方法吗? {0x01, 0x02, ..., 0xFF}。单引号用于字符,而不是整数文字。
-
是的,这就是我想要的,不知道该怎么做,我来自 php 世界。 @MitchellKline 最后我想要一个 uint8 来生成 CRC
-
例如uint8_t 事件[3] = {0, 0x07, 0xA5}。请注意,不保证 uint8_t 由实现定义,但在 arduino 上使用可能没问题。