极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12120|回复: 0

关于 itoa()函数

[复制链接]
发表于 2013-8-18 17:26:34 | 显示全部楼层 |阅读模式
void setup() {
     Serial.begin(9600);
     
     char y1[3];
     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>依然不行
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-8 23:17 , Processed in 0.032845 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表