Skip to content

Instantly share code, notes, and snippets.

@hotpaw2
Created December 9, 2017 01:19
Show Gist options
  • Save hotpaw2/c1d497fd064993b77c560fb911e9ba31 to your computer and use it in GitHub Desktop.
Save hotpaw2/c1d497fd064993b77c560fb911e9ba31 to your computer and use it in GitHub Desktop.

Revisions

  1. hotpaw2 created this gist Dec 9, 2017.
    25 changes: 25 additions & 0 deletions ble.perip.button.1.bas
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    100 rem BLE peripheral button service emulation
    102 rem for HotPaw Basic 1.7.7 , 2017-12 , by [email protected]
    104 rem Provides the same button service as a TI SensorTag
    106 rem Tap on the iPhone display to send a BLE notification
    108 rem Enter any character to exit
    110 rem
    120 fn btle.init()
    130 print "Initializing ..."
    140 fn sleep(1) : fn sleep(1)
    160 fn btle.name(1,"HotPaw Button Test")
    180 fn btle.advertise(1,"FFE0","FFE1","0")
    200 fn sleep(1) : fn sleep(1)
    220 print "Starting BLE button service"
    240 while (1)
    250 fn sleep(0.05)
    260 if fn mouse(0) <> 0
    265 print "sending tap"
    270 fn btle.update(1,str$(i))
    275 while fn mouse(0) <> 0 : fn sleep(0.05) : wend
    280 endif
    290 if len(inkey$ ) > 0 then exit while
    300 wend
    380 fn btle.advertise(-1)
    390 print "Ending BLE peripheral services"
    990 end