MicroBit Project #09 for INF 294
Project description:
Using code for MicroBit built in C/C++, send a message via radio TX that displays A when button A is pressed and B when button B is pressed. A second board receives the message and displays the corresponding character.
I used the MakeCode editor to test the algorithm in the MicroBit framework, then wrote the code in the mbed compiler to create the HEX file and test the program. I also edited the MicroBitConfig.h file to disable BLE so the radio could be enabled.
Following is the JavaScript that corresponds to the blocks in makeCode. This serves as a pretty good algorithm when the image of the blocks cannot be viewed.
input.onButtonPressed(Button.A, function () { radio.sendString("A") basic.showString("A") basic.pause(500) basic.clearScreen() }) input.onButtonPressed(Button.B, function () { radio.sendString("B") basic.showString("B") basic.pause(500) basic.clearScreen() }) radio.onReceivedString(function (receivedString) { basic.showString(receivedString) basic.pause(500) basic.clearScreen() })
https://os.mbed.com/users/tsfarber/code/microbit-9-sendButtonData/
Please log in to post comments.