I have a String containing 1s and 0s (e.g String str = "01001100";). I would like to convert that to a base 10 int. I know in standard java I could use (x = Integer.parseInt(str, 2)) but I don't have access to the Integer class in the Arduino language. How could I do this in Arduino.
Convert it to a char array, and calculate it yourself.
{ '0', '1', '0', '0', '1', '1, '0', '0', '\0'}
Subtract '0' from each element to get the decimal value. Start with a total of 0, and loop through each element, adding the decimal value for the element to your total. Left shift the total by 1 before moving to the next element.
The function int strbin_to_int(char* strbin) do this job. You have a little program that make the test of the function too, and other function to make the conversion "in the other direction".
Note that the example program only accept number of 1 digit.