Bluetooth Tank

I know there is already a tutorial out there for this, but I am trying to do it on my own, and am having trouble. I have got the bluetooth part of it set up and working(returns the cirrect value to the serial monitor) but it does not run the motor controller. If someone has the time, could you please take a look at my sketch and hint me toward WHY I am having issues? Thanks in advance,

Nate

TANKTEST.ino (9.92 KB)

Use code tag to embed the code, before posting CTRL+T to format the indentation. Also remove unwanted comments.

The while loop inside the loop() function is a blocking one. Check this post (http://forum.arduino.cc/index.php?topic=396450) about best practices in serial communication.

Just curious, why cant you send speed via bluetooth or store the speed in an array and use the det as an index and get the value, instead of condition chain.

Learning more. As I am a bit of a newbie, I comment everything I can (for my own benefit). The App I am using transmits a single letter for each button input. I am not sure yet how to set it up in an array, so I did it the way I did just to simplify it for myself until I get it to work. I can always revise it later. I know I am getting the info from the Bluetooth, as it prints in the serial monitor correctly, but the part where I send the corresponding command to the motor control module doesn't work, and that is what I am trying to figure out.

Thanks for the link, I am reading up on it now.....

May be your hardware connection might help to identify the issue. Post the schema of your setup. Some one might able to figure out the issue.

I understand your concern, sure you can revisit and refactor your code later.

Well, I figured out that the problem lies with the speed setting. I replaced the "spd" variable with a constant(200) and it runs. So I need to figure out why that is. At least I am narrowing it down. :-)