Skip to main content
added 2 characters in body
Source Link

I wrote this code to convert String to Hex Array.

const char* hexstring = "0x21 0x73 0x10 0xfa 0x7a 0x00 0xff .../*40995 character long string*/....0xaa"    
void setup() {
    char* temp;
    //Serial.printf("%s",hexstring);
    unsigned int number[8199];
    
    number[0] = strtoul (hexstring,&temp,16);
    for(int i=1;i<5;i++i=1;i<8199;i++)
     number[0]=number[i]= (int)strtoul(temp, &temp, 16);
    
    for(int i=0;i<8199;i++)
        {
            if(i%64)
                printf("\n");
            printf("%d, ",number[i]);
        }
}

void loop(){
}

But it is causing ESP32 to reboot. enter image description here

Could anyone help me with the reason why?

I wrote this code to convert String to Hex Array.

const char* hexstring = "0x21 0x73 0x10 0xfa 0x7a 0x00 0xff .../*40995 character long string*/....0xaa"    
void setup() {
    char* temp;
    Serial.printf("%s",hexstring);
    unsigned int number[8199];
    
    number[0] = strtoul (hexstring,&temp,16);
    for(int i=1;i<5;i++)
     number[0]= (int)strtoul(temp, &temp, 16);
    
    for(int i=0;i<8199;i++)
        {
            if(i%64)
                printf("\n");
            printf("%d, ",number[i]);
        }
}

void loop(){
}

But it is causing ESP32 to reboot. enter image description here

Could anyone help me with the reason why?

I wrote this code to convert String to Hex Array.

const char* hexstring = "0x21 0x73 0x10 0xfa 0x7a 0x00 0xff .../*40995 character long string*/....0xaa"    
void setup() {
    char* temp;
    //Serial.printf("%s",hexstring);
    unsigned int number[8199];
    
    number[0] = strtoul (hexstring,&temp,16);
    for(int i=1;i<8199;i++)
     number[i]= (int)strtoul(temp, &temp, 16);
    
    for(int i=0;i<8199;i++)
        {
            if(i%64)
                printf("\n");
            printf("%d, ",number[i]);
        }
}

void loop(){
}

But it is causing ESP32 to reboot. enter image description here

Could anyone help me with the reason why?

Source Link

ESP32 Rebooting while converting String to Hex Array

I wrote this code to convert String to Hex Array.

const char* hexstring = "0x21 0x73 0x10 0xfa 0x7a 0x00 0xff .../*40995 character long string*/....0xaa"    
void setup() {
    char* temp;
    Serial.printf("%s",hexstring);
    unsigned int number[8199];
    
    number[0] = strtoul (hexstring,&temp,16);
    for(int i=1;i<5;i++)
     number[0]= (int)strtoul(temp, &temp, 16);
    
    for(int i=0;i<8199;i++)
        {
            if(i%64)
                printf("\n");
            printf("%d, ",number[i]);
        }
}

void loop(){
}

But it is causing ESP32 to reboot. enter image description here

Could anyone help me with the reason why?