如何在c中为arduino将char arr转换为uint8_t数组

时间:2014-07-05 06:37:18

标签: c arrays arduino

我正在尝试将字符串传递给接受c中的uint8_t *的函数。

这是我的尝试,导致错误:

uint8_t data[70];    
char str[70];
sprintf(str,"U,DHT;T,%d;H,%d;I,%d", (int)(ft * 100), (int)(fh * 100), (int)(fi * 100));
strcpy(data,(uint8_t*)str);

我收到此错误:

.ino: In function 'void loop()':
ClimateClient:51: error: invalid conversion from 'uint8_t*' to 'char*'
ClimateClient:51: error: initializing argument 1 of 'char* strcpy(char*, const char*)'
ClimateClient:51: error: invalid conversion from 'uint8_t*' to 'const char*'
ClimateClient:51: error: initializing argument 2 of 'char* strcpy(char*, const char*)'

0 个答案:

没有答案