PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Android -> Basic! -> BTM222 (Serviervorschlag)



theborg
03.07.2012, 07:39
Hi,

Momentan versuchen ja viele das BTM-222 oder Ähnliches mit Android zu dongeln, ich hab was gefunden für Basic Junkis aber auch für andere die Syntax ist ziemlich einfach und man kann Standalone Programme erstellen, auch die meisten Handy/Tablett Funktionen werden unterstützt.

Google Play: https://play.google.com/store/apps/details?id=com.rfo.basic&feature=nav_result#?t=W251bGwsMSwxLDMsImNvbS5yZm8u YmFzaWMiXQ..
HP: http://laughton.com/basic/

Kleines BT Example liegt auch bei ich habe es etwas Abgeändert fürs BTM-222 und meiner Trägerplatine zum Testen.

Link: http://grautier.com/wiki/doku.php?id=bt-hauptmodul



! BT Aktivieren
bt.open


! Ask user what to do


array.load type$[], "Connect to listener", "Continue to listen for connection", "Quit"
msg$ = "Select operation mode"


new_connection:


select type, type$[], msg$


if (type = 0) | (type =3)
print "Thanks for playing"
bt.close
end
elseif type = 1
bt.connect
endif


Do
bt.status s
if s = 1
print "Listening
elseif s =2
print "Connecting"
elseif s = 3
print "Connected"
endif
pause 1000


until s =3


bt.device.name device$


! *** Read/Write Loop ****


RW_Loop:


Do


bt.status s
if s<> 3
print "Connection lost"
goto new_connection
endif


Do
bt.read.ready rr
if rr
bt.read.bytes msg$
print device$;": ";msg$
endif
until rr = 0

Input "Text to send", msg$
if (msg$ <> "") & (msg$<> "***") & (msg$<> "allon") & (msg$<> "alloff")
bt.write msg$
print "Send: "; msg$
endif


! Alle Ausgänge an
until msg$ = "allon"
bt.write msg$ "~>*?"
bt.write msg$ "~>+?"
bt.write msg$ "~>,?"
goto RW_Loop


! Alle Ausgänge Aus
until msg$ = "alloff"
bt.write msg$ "~>*@"
bt.write msg$ "~>+@"
bt.write msg$ "~>,@"
goto RW_Loop


! Discon.
until msg$ = "***"
bt.write "***"
bt.close
bt.open
goto new_connection