Re: smart home Arduino project with MIT app inventor

795 views
Skip to first unread message
Message has been deleted

Abraham Getzler

unread,
Apr 1, 2016, 4:19:52 PM4/1/16
to mitappinv...@googlegroups.com
You need a way to mark your sensor reading messages to identify them as either temperature or humidity, so the receiving blocks will know where to show them.

For example, println("T=",t);
println("H=",h);

and when you receive on the AI2 side,
If connected then
   if bytes available > 0 then
     set m = incoming message
     if the front of the message is "T=", copy the rest to the temp label
     if the front of the message is "H=", copy the rest to the humiditylabel


See the text blocks for length(), split at, segment.

ABG

Message has been deleted

Abraham Getzler

unread,
Apr 5, 2016, 6:37:02 PM4/5/16
to MIT App Inventor Forum
You are probably receiving both T and H in the same message m.

Try setting your BT Client Delimiter Byte to 10 in the Designer,
and set the BTClient.ReceiveText Number of Bytes to Receive to -1.

This will get you only one reading per message because it will
split them at the Line Feed.

ABG

Message has been deleted

Abraham Getzler

unread,
Apr 5, 2016, 6:52:42 PM4/5/16
to MIT App Inventor Forum
AI2 has no wait() block,
but you can use a Clock from the Sensors drawer and set it as a timer.
ABG

Taifun

unread,
Apr 5, 2016, 7:45:30 PM4/5/16
to MIT App Inventor Forum
see Scott's "Please Wait" method here https://groups.google.com/d/msg/mitappinventortest/PhX0rRpvH-Q/fcUacQziCwAJ
Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Reply all
Reply to author
Forward
0 new messages