If the micro:bit runs out of resources or detects a fault, it enters a 'panic' routine which displays a sad face on the micro:bit screen followed by a number eg 020.
Here is a list of the errors, what they mean and what you can do to fix. In all cases, pressing the reset button on the back of the micro:bit will restart the program, which clears out the RAM memory and starts again.
|Error code ||What this means ||What you should do|
|10||The micro:bit's I2C bus is not working. The device might be physically damaged.||Submit a support ticket to get more help.|
|20||There is no free memory on the micro:bit. Your program might be too complex or contain a lot of large variables.||Try reducing your code, making functions out of large sections or inserting a pause into a loop.|
|30||Corruption detected in the micro:bit heap space (memory allocated usually for the strogage of variables).||Try flashing a different .hex file to your device or submit a support ticket to get more help.|
|40||Your micro:bit can't execute your script properly.||Flash a different .hex file to it, then try flashing and running your previous script again|
|42||Your micro:bit can't execute your script properly.||Flash a different .hex file to it, then try flashing and running your previous script again.|
|43||An error occurred with the micro:bit's radio component.||Submit a support ticket to get more help.|
|50||An error occurred with the micro:bit's accelerometer component.||Submit a support ticket to get more help.|
|51||An error occurred with the micro:bit's magnetometer component.||Submit a support ticket to get more help.|
If you are using C++, then these errors are more likely if you have a bug in your C++ program.
The micro:bit runtime documentation contains a list of the codes, which are repeated here for reference.
// Out out memory error. Heap storage was requested, but is not available. MICROBIT_OOM = 20, // Corruption detected in the micro:bit heap space MICROBIT_HEAP_ERROR = 30, // Dereference of a NULL pointer through the ManagedType class, MICROBIT_NULL_DEREFERENCE = 40, // A requested hardware peripheral could not be found, MICROBIT_HARDWARE_UNAVAILABLE_ACC = 50, MICROBIT_HARDWARE_UNAVAILABLE_MAG = 51,
The Javscript Blocks Editor builds on these and adds additional information eg 042
Keywords for search: sad face, error, error codes, panic code, 020, 050, 051