Microsoft MakeCode

Radio-remote control

Hi!
I’ve created an automate with a servo and I want to control it with a remote control. So, I use two microbit. The code for the microbit of the servo is:
image
The code for the remote control is:
image

But it does not work. I do not know if I am missing something.

Save receivedNumber into a variable like radionumber. Then ask if radionumber = … then
The Problem is that the buffer with receivednumber is cleared and empty once you call it.

Good luck

Michael

The basic idea looks pretty good. You might try a few things to debug it:

  • Try servo activities by themselves using Buttons A and B. For example, A for forward, B for backward, and A+B to stop. This will help you figure out if your servo works.
  • Then try just radio things using the screen. Here’s another version of the receiver that may be worth trying. It’ll use the screen to show which button was pressed: https://makecode.microbit.org/_XVV8jFHgMFU6 (Notice that it’s just displaying images where you have the servo commands. I also went with if/else-if.)

Please post a follow up message sharing what you find or if/when you get it to work.

Bill

Thank you all for your help. It works now. This way:
image