#include "MicroBit.h" #include "ManagedPrintf.h" MicroBit uBit; void displayHello() { unsigned long counter = 0; while (1) { // loop for ever counter++; ManagedString mStr = ManagedPrintf::printf("loop count:%lu\n", counter); uBit.serial.send(mStr); // or just uBit.serial.send(ManagedPrintf::printf("loop count:%lu\n", counter)); int rtn = uBit.display.scrollAsync("HELLO WORLD!"); if (rtn == MICROBIT_OK) { uBit.serial.send("Display OK\n"); } else if (rtn == MICROBIT_BUSY) { uBit.serial.send("Display Busy\n"); } else { // error uBit.serial.send("Invalid param\n"); } uBit.sleep(1000); // wait 1sec and loop to try and display again } } int main() { uBit.init(); create_fiber(displayHello); // create fiber and schedule it. release_fiber(); // "release the fibers!!" }