Skip to first unread message

rika agus

unread,
Jul 20, 2016, 3:25:47 AM7/20/16
to mitappinv...@googlegroups.com
help me please!
The arduino sending a string "temperature" from DHT by using bluetooth, and send day from 1 to 7 with RTCi can see the program still running well at the back of the pop up message "invalid text operation "segment: Length is negative (-4).""

How to get rid
 of this error ??  "segment: Length is negative (-4)."



thank you before.


Ghica

unread,
Jul 20, 2016, 5:13:27 AM7/20/16
to MIT App Inventor Forum
Hi,
I do not know what your problem is, because I cannot see the contents of global buf, but I do know how you should debug it.

insert a clock2.enabled = false just before you set the text labels. This will prevent the clock from firing again, and it allows you to look at the problem.
Then right-click with your mouse on a get global buf block, choose DoIt and see what you get. Then check if your segmenting of the text is ok. You can eventry it out by pasting the text in a text block and try to segment it until you get the right answer.

Another option would be to show the unsegmented text in the labels, this can also show you what is wrong.
Cheers, Ghica.

rika agus

unread,
Jul 20, 2016, 8:31:00 AM7/20/16
to MIT App Inventor Forum
thank you ghica, i will try your solution :)

Abraham Getzler

unread,
Jul 20, 2016, 1:25:51 PM7/20/16
to MIT App Inventor Forum
Also consider keeping a rolling log of your incoming buffers that you can display in a label or listview.
As each buf arrives, insert it at position 1 of a global LOG list initialized to make-list("End of List")
That way, you will always see the newest at the top.

ABG

Reply all
Reply to author
Forward
0 new messages