Hi,
I have a setup with 1 micro:bit that (radio) receives data, and 10 other that send data (yes/no votes).
I need to receive the sender's data only when the reception function is "open".
Outside this window any data sent should be disregarded.
What would be the best approach to disregard any sent messages, without switching off power
on the receiving side.
thx,
Paul
radio receive
Re: radio receive
An if statement.
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas
My repositories: https://github.com/karfas
Re: radio receive
Hi,
hth,
lujo
Code: Select all
run = False
while True:
if button_a.was_pressed():
run = not run
if run:
data = radio.receive()
if data:
...
lujo
Re: radio receive
Thanks Lujo, good idea ;
Of course, i need to switch it on and off again: button_a twice
(I'm in luck, buttons are free from other functions, so it might work.)
To show the status, we could show an Image.
Dpaul
Of course, i need to switch it on and off again: button_a twice
(I'm in luck, buttons are free from other functions, so it might work.)
To show the status, we could show an Image.
Dpaul
Re: radio receive
After giving it some thought, I wonder why the kiss solution
was not proposed. If I can do radio.on(), there must be a radio.off().
No need for extra variables, no nested if statements.
Two Images to reflect the status. Done.
Dpaul
was not proposed. If I can do radio.on(), there must be a radio.off().
No need for extra variables, no nested if statements.
Two Images to reflect the status. Done.
Dpaul