convert HEX string to Decimal in arduino

后端 未结 2 438
傲寒
傲寒 2020-12-21 12:34

i have an Hex String like this : \"0005607947\" and want to convert it to Decimal number , i test it on this site and it correctly convert to decimal number and answer is :

2条回答
  •  無奈伤痛
    2020-12-21 12:45

    You are trying to store the value 90208583 in an int. Arduino has a 2 byte int size meaning that the largest number you can store is 2^16-1 (65535). You have a couple of options:

    1. Use an unsigned int
      • min number: 0
      • max number: 4,294,967,295
      • cons: can only be used for positive numbers
    2. Use a long int
      • min number: -2,147,483,648
      • max number: 2,147,483,647

提交回复
热议问题