Skip to content

uBit Base API

init

int
init
()

Description

Post constructor initialisation method.


sleep

void
sleep
(
uint32_t
milliseconds)

Description

Delay execution for the given amount of time.

If the scheduler is running, this will deschedule the current fiber and perform a power efficient, concurrent sleep operation.

If the scheduler is disabled or we're running in an interrupt context, this will revert to a busy wait.

Alternatively: wait, wait_ms, wait_us can be used which will perform a blocking sleep operation.

Parameters

uint32_t
milliseconds - the amount of time, in ms, to wait for. This number cannot be negative.

Returns

MICROBIT_OK on success, MICROBIT_INVALID_PARAMETER milliseconds is less than zero.


systemTime

unsigned long
systemTime
()

Description

Determine the time since this MicroBit was last reset.

Returns

The time since the last reset, in milliseconds.

Note

This will value overflow after 1.6 months.


Component Constructor

Advanced users only

Do not use this unless you really know what you're doing. It's usually best to use uBit.

MicroBit()

Description

Constructor.

Create a representation of a Genuino Zero device, which includes member variables that represent various device drivers used to control aspects of the board.