Kas ... I've had the data field etc become just xxx ...and stay like that after reconnecting to the Blue Tooth....but only when I've been playing about uploading new code to the Arduino with the Joystick Commander App still ON ...turning the App OFF then ON again resolves this for me.
Is it OK to remove the if**(i==7)** and just have else?
i<>2 and i<>7 means "communication error"
You can't expect valid data out of bad data frames
I realise that the joystick data read... if any ... by removing the if and i==7 may not be valid but it would give Antonio "hope" to see something being produced by the joystick .... even if it is WRONG.
But your right it may well be best to track down the real reason for the problem.
So.
Any idea of what the data problem is likely to be or the solution?
Do you suspect that it is simply the current Android phone being used that is at fault?
@woody
Quote
Do you suspect that it is simply the current Android phone being used that is at fault?
Data transmission is not far from Black Magic
very sensitive to timing issues that could be generated by an underpowed device
I downloaded - AndroTest_V20_POSTED_DEBUG.ino from your post #425, this is the same one as before, I'm assuming, but I downloaded again to make sure and that is what you want me to try, correct?
Here's the video, towards the end of the video I zoom in while using the phone, at that point you'll be able to see the data up close.
Now I'm assuming that I'm not the only guy that this is happening to?.....maybe? However, I have been know to lose a bet on a one horse race. Hopefully this is not the case here.
while(mySerial.available()) {
delay(1);
cmd[i] = mySerial.read();
if(cmd[i]>127 || i>7) break; // Communication error
if((cmd[i]==ETX) && (i==2 || i==7)) break; // Button or Joystick data
i++;
}
within AndroTest V2, this "while" loop does collect the incoming data frame and should succesfully exit when receiving an ETX (0x03) byte.
Error exit is triggered if received Byte is >127 or frame lenght is >8
As you see, for some reason, Arduino receives Bytes >127 (149, 144, 176 ...) and a Data frame error is generated.
I tried to reproduce these errors without success :-\ :-\
This is a call for witnesses
buttons data display = OK
joystick data display = not OK
Anyone ??
>> EDIT <<
Problem solved using a genuine Uno
See reply #447
Antonio,
In loop() function, try commenting last line:
sendBlueToothData(); -> // sendBlueToothData();
This will stop Arduino to Android communication and reduce Bluetooth traffic
Also for the good sake, confirm again your BT card baudrate
Finally let us know the outcome, using another phone/tablet
If I use the Hardware serial ports on the Mega, everything works perfectly, no odd bits
Using SoftwareSerial it does not work on the Uno or Mega.
So I assume that the Bluetooth module is fine, but the SoftwareSerial has a problem
Antonio,
Please confirm you have a Mega Arduino available
This board has several hardware serial ports that may solve the problem
I will then prepare a V2.0 sketch for the Mega, for you to test