Skip to content

Instantly share code, notes, and snippets.

@hotpaw2
Created December 9, 2017 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hotpaw2/c1d497fd064993b77c560fb911e9ba31 to your computer and use it in GitHub Desktop.
Save hotpaw2/c1d497fd064993b77c560fb911e9ba31 to your computer and use it in GitHub Desktop.
100 rem BLE peripheral button service emulation
102 rem for HotPaw Basic 1.7.7 , 2017-12 , by rhn@nicholson.com
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment