Program your paired Bluetooth devices from TouchDevelop.
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
connect to any particular device, and you can check if you have
var device := devices → random
if not device → connected then
"not connected!" → post to wall
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.