1
- ### bluetooth-microscout-vll-control v0.9
1
+ ### bluetooth-microscout-vll-control v1.0
2
2
### Bluetooth Remote Control for the Micro Scout from Lego(tm) Droid Developer Kit
3
3
### On an Adafruit Feather M0 Bluetooth LE board
4
4
### or a CircuitPython compatible board using the Adafruit Bluefruit LE SPI Friend
40
40
from adafruit_bluefruitspi import BluefruitSPI
41
41
42
42
### Setup SPI bus and 3 control pins for Nordic nRF51822 based Raytec MDBT40
43
+ ### board.D8 is not defined on the basic CircuitPython hence the strange
44
+ ### need to use the adalogger variant
43
45
spi_bus = busio .SPI (board .SCK , MOSI = board .MOSI , MISO = board .MISO )
44
46
cs = DigitalInOut (board .D8 )
45
47
irq = DigitalInOut (board .D7 )
49
51
### see https://github.com/adafruit/Adafruit_CircuitPython_BluefruitSPI/issues/8
50
52
bluefruit = BluefruitSPI (spi_bus , cs , irq , rst , debug = False )
51
53
52
-
53
54
boardled = DigitalInOut (board .D6 )
54
55
##boardled = DigitalInOut(board.D13) ### small onboard red LED
55
56
boardled .direction = Direction .OUTPUT
@@ -71,7 +72,6 @@ def vllchksum(n):
71
72
PAUSE = 0.15
72
73
73
74
ADVERT_NAME = b'BlueMicroScout'
74
- ##ADVERT_NAME = b'BlinkaNeoLamp'
75
75
76
76
### Note: incompatibile with ZX Spectrum cursors
77
77
BUTTON_1 = const (1 )
@@ -130,15 +130,9 @@ def pause():
130
130
boardled .value = True
131
131
time .sleep (PAUSE )
132
132
133
- #led = ev3.Led(name_pattern=LED_DEVICE)
134
133
boardled .value = False
135
134
136
- #btn = ev3.Button()
137
-
138
135
vllinit ()
139
- #time.sleep(5)
140
- #print("sending MS_BEEP")
141
- #send(MS_BEEP)
142
136
143
137
def init_bluefruit ():
144
138
# Initialize the device and perform a factory reset
@@ -177,7 +171,6 @@ def check_connection(n_sec):
177
171
### Note: read_packet looks a bit buggy
178
172
### see https://github.com/adafruit/Adafruit_CircuitPython_BluefruitSPI/issues/9
179
173
180
-
181
174
### Nabbed off MUNNY code which may have been inspired by library examples directory
182
175
183
176
# Unlike most circuitpython code, this runs in two loops
@@ -219,17 +212,3 @@ def check_connection(n_sec):
219
212
except RuntimeError as e :
220
213
print (e ) # Print what happened
221
214
continue # retry!
222
-
223
-
224
- #pause()
225
-
226
- #while True:
227
- # if btn.left:
228
- # send(MS_REV)
229
- # pause()
230
- # elif btn.right:
231
- # send(MS_FWD)
232
- # pause()
233
- # elif btn.up:
234
- # send(MS_BEEP)
235
- # pause()
0 commit comments