BBC Micro:Bit MicroPython no module named radio
Posted: Tue Jul 19, 2016 11:46 pm
Trying to use the radio module in MicroPython on my BBC Micro:Bit. There's example code, intended to create an effect similar to a swarm of fireflies by using multiple flashing Micro:Bits, at http://microbit-micropython.readthedocs ... radio.html.
Tried running, first, code derived from that example and, when that didn't work, tried running an exact copy of the example code. Each time I get an error message saying no module named radio was found.
The lines in the example code supposed to import any modules needed are:
import radio
import random
from microbit import display, Image, button_a, sleep
As these didn't work, I tried varying them to:
from microbit import radio, random, display, Image, button_a, sleep
and, when that didn't work, to
from microbit import *
No joy. I still haven't got to the bottom of the problem of the module not being found and haven't found an answer by Googling.
As may well be apparent, I'm new not only to the Micro:Bit but also to MicroPython.
Any helpful suggestions, please?
Incidentally, I found some material about radio on the micro:bit at https://lancaster-university.github.io/ ... bit/radio/ and that included a note saying it's not possible to run the MicroBitRadio component and Bluetooth Low Energy at the same time. To use the former, you have to disable the BLE stack. A method for doing this was shown in the context of working with C/C++, rather than MicroPython, by editing MicroBitConfig.h. I'm quite unsure whether this is relevant to the problem or whether it is a complete red herring.
Tried running, first, code derived from that example and, when that didn't work, tried running an exact copy of the example code. Each time I get an error message saying no module named radio was found.
The lines in the example code supposed to import any modules needed are:
import radio
import random
from microbit import display, Image, button_a, sleep
As these didn't work, I tried varying them to:
from microbit import radio, random, display, Image, button_a, sleep
and, when that didn't work, to
from microbit import *
No joy. I still haven't got to the bottom of the problem of the module not being found and haven't found an answer by Googling.
As may well be apparent, I'm new not only to the Micro:Bit but also to MicroPython.
Any helpful suggestions, please?
Incidentally, I found some material about radio on the micro:bit at https://lancaster-university.github.io/ ... bit/radio/ and that included a note saying it's not possible to run the MicroBitRadio component and Bluetooth Low Energy at the same time. To use the former, you have to disable the BLE stack. A method for doing this was shown in the context of working with C/C++, rather than MicroPython, by editing MicroBitConfig.h. I'm quite unsure whether this is relevant to the problem or whether it is a complete red herring.