Go Down

Topic: question about arduino due and function itoa (Read 1 time) previous topic - next topic

liang

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() {
}


AWOL

That's a really long-winded way of writing
Code: [Select]
Serial.println (L, HEX);
"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.

liang

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.

AWOL

"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.

Go Up