# Connect to the RuuviTag from BASIC!

**URL:** https://f.ruuvi.com/t/connect-to-the-ruuvitag-from-basic/529
**Category:** 🇬🇧 Tell about your own use-case
**Created:** [16 July 2017 17:23 UTC](https://f.ruuvi.com/t/connect-to-the-ruuvitag-from-basic/529 "2017-07-16T17:23:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ShipwreckSoftware](https://f.ruuvi.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@ShipwreckSoftware](https://f.ruuvi.com/u/ShipwreckSoftware)
#### Post date: [16 July 2017 17:23 UTC](https://f.ruuvi.com/t/connect-to-the-ruuvitag-from-basic/529/1 "2017-07-16T17:23:26Z")

</div>

My project (just completed) is to add support for the RuuviTag device into the BASIC interpreter of my “[Best Calculator, IOT edition](http://bestcalculator.wordpress.com)” app. The latest update was just published on the[Windows app store](https://www.microsoft.com/en-us/store/p/best-calculator-iot-edition/9pppnjc8d60g).

Hooking up the ruuvi was pretty easy except that the temperature data format was a surprise (the upper byte isn’t a regular 2’s complement number; it’s a sign-magnitude value). And my BASIC interpreter never had to deal with EddyStone formats before. Once I could support EddyStone in general, supporting the RuuviTag was simple.

Here’s a simple BASIC program that picks apart each Ruuvi broadcast:

```
Bluetooth.Watch (“RuuviTag”, “ruuvi”)
MAXTIME = 10
FOR time = 1 TO MAXTIME
    Screen.ClearLine (1)
    now = DateTime.GetNow()
    PRINT now.Time
    PAUSE 50
NEXT time

FUNCTION ruuvi (address, rssi, txpower, ↲
    temperature, pressure, humidity)

    Screen.ClearLines (3, 9)
    PRINT “Temperature”, temperature
    PRINT “Pressure”, pressure
    PRINT “Humidity”, humidity

    PRINT AT 7,1 "Address", address
    PRINT "RSSI", rssi
    PRINT "TX", txpower
END
```
