Bluetooth control from your Android phone or tablet

Hello, I am the author of Mintoris Basic for Android phones and tablets.  I recently added Bluetooth serial communications to the language with the intention of making it very easy to communicate and control robots.

Here is a short example program in Mintoris Basic which connects to a device then transmits data from the phones accelerometer.  So as you tilt the phone or tablet in any direction, the amount of tilt is sent to the Bluetooth device.

dim a$(0)
dim c(4)

' Get a string array of all the paired Bluetooth devices

a$()=BTGetPaired$()

' Show the user a list of devices to connect to.
list a$(), d$

print BTGetState(1)
print BTGetError$(1)
print

print "Connecting to: ";d$
 
name$ = ItemExtract$(d$, 0)
address$ = ItemExtract$(d$, 1)

' Start a Bluetooth connection

BTConnect 1, address$

' Wait for connection
for i = 1 to 30
print BTGetState(1);" / ";
print BTGetError$(1)
if BTGetstate(1)=4 then exit for
wait 1000
next i

sensors on

' Send the accelerometer data
Top:
c()=getaccelerometer()
BTWrite 1, str$(c(0))
BTWrite 1, ", "
BTWrite 1, str$(c(1))
BTWrite 1, ", "
BTWrite 1, str$(c(2))
BTWrite 1, chr$(13)
BTWrite 1, chr$(10)
wait 50
goto Top

 

LMRBluetooth02.jpg

 

LMRBluetooth01.jpg

I would be happy to send free copies of Mintoris Basic to the first two people who email [email protected].  Mention that you saw this on "Let's Make Robots".  Send the email from an account you can view from your Android device to make installation easy.