2016년 12월 30일 금요일

Bluetooth Problem with Arduino


I made my project to conect and setup arduinos PWM-s with BT app made in MIT APP INVENTOR 2.

When i tested it on my phone with android 5 (LG G2) everything works perfect.
Data string : *83,13,58,37,2016,4,25 is readed from arduino and interpreted by app

When i Upload app to tablet HP on android 4.1. i get error 
Data string from arduino readed by app looks:
83,13,58,37,2016,4,25
*
When I connected arduino by USB cable and open rs com get 
*83,13,58,37,2016,4,25
but app get
83,13,58,37,2016,4,25
*
Same error with phablet woo on android 4.2.2

I don't know how to solve this problem.
Becouse in app i have to make list from cvs (separeted by , ) i got an error   and the app is closing

--
*83,13,58,37,2016,4,25
so the question is, where is the star coming from?


Becouse in app i have to make list from cvs (separeted by , ) i got an error   and the app is closing

which error do you get? you might want to remove the star before converting the string into a list

It would really help if you provided a screenshot of your relevant blocks and your Arduino code, so we can see what you are trying to do, and where the problem may be.

-- 
I have attached the basic procedure.

With android 5 it works ok.
but with 4 get an error.

Best regards

arduerrorpng.png 표시 중

--
the star is answer from arduino it shuld come at the begining of the string than 83 is a code of the procedure in arduino to send time and date in dallas chip

when i send 40,......................... i change date and time in ardu...

-- 
The string from arduino :
*83 - procedure to send date from arduino  (I am asking ardu 83 it answers *83)
procedure,hour,minute,second,year,month,day

-- 
Looking at your AI2 blocks, I see a problem with your send/receive timing.

You send an 83 to Arduino when your AI2 button is clicked, but then you IMMEDIATELY try to 
receive data from the Arduino, without giving it a chance to build a response and send it to AI2.

I suggest moving the AI2 reception blocks to a Clock timer routine,
activated after the 83 is sent to Arduino, non-repeating and self-disabling.

Also, I suggest investigating the use of a Bluetooth delimiter byte to help distinguish between the start of one message and the end of the previous message.

-- 
I think that you are right. Probobly on Android 5 works becouse i have BT 4 Module and he is fast enough and it worked.

I'll try with timer, and give you a note.

-- 
Ok . So I have tried with Timer. But I think that it wasn't a problem.
It solved problem with bad data read (not full path....) but not that the text receved from arduino for android 5 is interpreted exactly as it was sent from arduino, but in android 4 get same error.
Just looks like "*" is interpreted like different list of data not as one string. which is strange because of Call(BT)Bytes.AvailableToReceive

-- 
I managed to solve the problem

Now it works, but as you see it was little complicated.

Solved.png 표시 중

-- 
Are you turning this in as an assignment?

If so, there are some things in your blocks you will be challenged on.

The first ELSEIF branch in your timer looks very fishy.
You are comparing a true/false comparison result value against a blank text?
How do you expect that to turn out?
And what do you do if it is true?  Assign something into itself?

-- 

댓글 없음:

댓글 쓰기