Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "MicroBit.h"
- MicroBit uBit;
- MicroBitButton buttonA(MICROBIT_PIN_BUTTON_A, MICROBIT_ID_BUTTON_A);
- //Construction of a struct for the binary tree used
- //accepting a node that either translates to a dash
- //or a dot
- struct tree
- {
- char key_value;
- node *dash;
- node *dot;
- };
- tree* treeChar(char key_value)
- {
- tree* tree = new struct tree;
- tree->DOT = NULL;
- tree->DOT = NULL;
- tree->data = key_value;
- return tree;
- }
- //Function to receive data and translate said data
- //into characters from morse code
- void recieve(MicroBitEvent)
- {
- //Tree is created and the node is set to the root
- //of the binary tree
- tree* treeRoot = treeChar('');
- tree* treeNode = treeRoot;
- }
- int main() {
- // Initialise the micro:bit runtime.
- uBit.init();
- bool pressed = false;
- // loop while button A pressed
- while (buttonA.isPressed())
- {
- pressed = true;
- }
- release_fiber();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement