Evening all. I'm stuck on a prob with an array read from an sd card. The string is a series of numbers 100601111.
This number represents - 10 a number used as a "timer", 060 as an integer for a calculation, and 1111 as 4 analogue inputs the 1 representing an on and 0 as off.The leading 0 of 060 is as a 'place holder' as this number could have 3 digits and i'd rather not program a lot of adjusting to the array size or individual character placement. The 1111 is 4 bits either on (1) or off (0)
I can read in the array correctly but I'm struggling with how to get the 10 as an integer and the 060 the same but separately. If i can get these 2 sorted i'll figure the four 1's
The 10 is being interpreted as 'a' which of course is 10 as hex
I'm not sure if i have understood the string manipulation on the wiki.
Any help would be appreciated as my head is pickled this time
arrays and strings
-
- Posts: 265
- http://meble-kuchenne.info.pl
- Joined: Tue Jul 13, 2021 1:53 pm
- Has thanked: 36 times
- Been thanked: 29 times
-
- Valued Contributor
- Posts: 1462
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 136 times
- Been thanked: 713 times
Re: arrays and strings
See viewtopic.php?f=3&t=1286&p=7220#p7220 - where this is some example of splitting a string into segments and also converting a hex string to an integer.
Martin
Martin