This is my first time posting here and I am not used to forums in general, so I am sorry if I have made a mistake in my post.
I am working on an Arduino powered smartphone controlled robot and I cannot to get the Arduino sketch to work correctly.
The controls of the robot are based on a 10 digit number sent via bluetooth which gets broken down into single digits and loaded into an array, each integer in the array is then checked to determine if a part of the system is on or off.
Before I started making the Arduino sketch, I tested out my control data decoding algorithm by making this. Which went well and did everything I needed it to with no issues.
But when it came to implementing it in the Arduino sketch I could not get it to work. Here is what I have got so far for the sketch. I have used all the same data types in the Arduino sketch as I have used in the in the C++ program and also tried using a number of different data types such a long int and float, with limited success. I managed to get the sketch working by declaring the bluetooth_input and the doubles used in my split function as long int, but this meant that it only worked when the control data started with a 1, when it started with 0 it did not work, unlike my original program.
Another problem, is that the first for loop (line 146) gets itself stuck in an endless cycle if the number in the condition is greater than 9 and I am unsure why. I have checked the split function, as the loop just calls the function 10 times, but I cannot see anything which would effect the counter. I have put a work around in place to circumvent the problem but would still like to know if anybody knows what may cause this problem for future reference.
This is the first big project I have done with Arduino and C++, so I am not entirely sure what I am doing. If any anybody knows what could be causing these problems, I would very much appreciate your help.
Thank you, notroot.