Pages: [1]   Go Down
Author Topic: question about arduino due and function itoa  (Read 1005 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,
I was trying to compile board Arduino Due with the most updated compiler V1.5.2, but the error happends like error: 'itoa' was not declared in this scope. But if I selected Arduino 2560, everything is good. Anyone can help me with this, actually this is my dad's question, he just can't find any help from Chinese arduino forum. Thanks guys! Here are my codes:

#include <stdlib.h>
void setup() {
     Serial.begin(9600);
     
     char y1[3];
     //String y1;
     String y;
     int L=9;
     itoa(L,y1,16);
     y=y1;
     if (y.length()==1){y="0"+y;}
     y.toUpperCase();
     Serial.print("L hex=");
     Serial.print(y);
}

void loop() {
}

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25775
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's a really long-winded way of writing
Code:
Serial.println (L, HEX);
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry, that's not what i need. For the code, I want get two digits result of L. For example, if L is E, it should be printed out 0E.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25775
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Two extra lines of code required.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: