Bluetooth Servo w/LED's. issues...

Thread Starter

jgreene44

Joined Dec 8, 2016
108
its working spinnaker. 100% just cant get that part of the code to function. current setup includes one led and, one servo to verify just that. Keep saying its the code lol. If I didnt make it abundandly clear. Im still very much a noob with coding. I'm just getting to where I understand other peoples code. sure cannot correct my own.
 
Last edited:

spinnaker

Joined Oct 29, 2009
7,830
I see you are just calling your variables bluetooth.

Do you have a scope or logic analyzer? If so can you see data being transmitted to the Arduino and arriving on the expected pin?

Where is your schematic by the way?
 

spinnaker

Joined Oct 29, 2009
7,830
its working spinnaker. 100% just cant get that part of the code to function. current setup includes one led and, one servo to verify just that. Keep saying its the code lol. If I didnt make it abundandly clear. Im still very much a noob with code. I'm just getting to where I understand other peoples code. sure cannot correct my own.

You need to articulate exactly what you are trying to do and what is not working (exactly not in general terms).
 

spinnaker

Joined Oct 29, 2009
7,830
What happens here for example?

unsigned int servopos = bluetooth.read();
unsigned int servopos1 = bluetooth.read();

Use you debugger or the terminal to echo values and see if you are getting the values that you expect.
 

djsfantasi

Joined Apr 11, 2010
9,237
When reading the value to control the servos, the code calls the function bluetooth.read; when reading the values for the LED, the code calls the function Serial.read.
 

JWHassler

Joined Sep 25, 2013
308
The six servos that you control are being sent each a number between 0 and 180, corresponding to the desired angle.
In order to simplify the command protocol, these six, 0-180 counts are each offset by 1000*(servo_index), allowing every pair of bytes sent to be significant, but causing big problems if you get out of sync and making it near impossible to debug visually, due to the strictly binary format
Is your Android program sending numbers in the correct format (i.e., 0-180, 1000-1180, 2000-2180 etc)?

A look at the Ardudroid program you mentioned shows that it would have been a satisfactory framework for what you are doing, except that it only has four sliders, not six.
 

Thread Starter

jgreene44

Joined Dec 8, 2016
108
Its definitely an issue with my code. sure wish someone would just point out what. Dj you made a good point. I tried replacing the serial.read with a bluetooth.read actually had tried that before I posted. no change.
 

spinnaker

Joined Oct 29, 2009
7,830
Its definitely an issue with my code. sure wish someone would just point out what. Dj you made a good point. I tried replacing the serial.read with a bluetooth.read actually had tried that before I posted. no change.

You you only answer half of the questions asked, how do you expect people to help you?
 
Top