hi so i've been trying to convert an int to a hexadecimal string some conversions work but when i try to print it in the monitor i get:
FFáâ7ó^}eøõ6·èÀ»[ðÿÿâïå}÷îÖëõòQ÷źþkþÓù¦t|¼ýûßÏÿNO;×ð]§\ø8WçÿM±¸½¸ã/ó
here is my code
void setup() {
Serial.begin(9600);
}
void loop(){
String string_Of_Hex_Numbers;
Decimal_To_Hex(255, string_Of_Hex_Numbers);
Serial.println(string_Of_Hex_Numbers);
}
void Decimal_To_Hex(int decimal_Number_To_Be_Converted_To_Hex, String &hex_Number_Array_As_String){
int place_Of_Hex_Symbol = 0;
char hex_Number_Array[100];
long quotient = decimal_Number_To_Be_Converted_To_Hex;
long remaining_Number_After_Devision;
while (quotient != 0)
{
//first we do a modulo on the quotient to see what remains
//then we assign a symbol to it
remaining_Number_After_Devision = quotient % 16;
if (remaining_Number_After_Devision < 10){
hex_Number_Array[place_Of_Hex_Symbol++] = 48 + remaining_Number_After_Devision;
quotient = 0;
}
else{
hex_Number_Array[place_Of_Hex_Symbol++] = 55 + remaining_Number_After_Devision;
quotient = quotient / 16;
}
}
hex_Number_Array_As_String = String(hex_Number_Array);
}
does anyone know where my error could be?
thanks in advance