and receive our newsletter to get the latest news and tips.


This page describes how TouchDevelop can interact with Bluetooth devices.

supported platforms

  • 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.

enumerating devices

You can enumerate all paired devices. If Bluetooth is not available, it returned invalid.
var devices := senses → bluetooth devices


You can try to connect to any particular device, and you can check if you have connected successfully.
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.

samples scripts