This page describes how TouchDevelop can interact with Bluetooth devices.
- TouchDevelop app for Windows Phone 3.1 and up
- TouchDevelop on Android through WebAppBooster
This code might not work on your current device: missing Bluetooth capabilities.
You can enumerate all paired devices. If Bluetooth is not available, it returned
var devices := senses → bluetooth devices
You can try to
connectto any particular device, and you can check if you have
var device := devices → random
device → connect
if not device → connected then
"not connected!" → post to wall
else do nothing end if
reading and writing bytes
Once connected, you can read bytes...
var buffer := device → read buffer(10)
... and write bytes...
device → write buffer(buffer)
You have to find documentation on the protocol supported by your Bluetooth device to figure out what exactly you need to read or write.
TouchDevelop currently only supports the RFCOMM protocol.