liang123599 发表于 2013-8-18 17:26:34

关于 itoa()函数

void setup() {
   Serial.begin(9600);
   
   char y1;
   String y;
   int L=9;
   itoa(L,y1,16);//把10进制数值变为16机制串
   y=y1;
   if (y.length()==1){y="0"+y;}//长度为1前面补0,使长度成为2
   y.toUpperCase();//把字符串全部转化为大写
   Serial.print("L hex=");
   Serial.print(y);//输出
}

void loop() {
}

上述代码用arduino1.5.2选2560板子,执行正常
选了arduino Due后编译通不过。
提示错误:error: 'itoa' was not declared in this scope
加了#include <stdlib.h>依然不行
页: [1]
查看完整版本: 关于 itoa()函数