mbino is a library that provides several mbed OS 2 APIs for the Arduino platform.
Currently, the following APIs are - at least partially - supported:
For an overview on how to use these, have a look at (and try out!) the example programs.
-
Only AVR 8-bit microcontroller boards are supported. This means no support for Arduino Due, Zero or M0, etc.
-
Although mbed programs usually have a
main()
function, you can still write sketches based onsetup()
andloop()
, if you want to. This can be useful to sprinkle an existing sketch withprintf()
statements for debugging, for example. -
The standard file descriptors
stdin
,stdout
, andstderr
are set up by default to point to Arduino's serial monitor, so thatprintf()
et al. work out of the box. However, with the current implementation, this leads to a significant increase in code size, even if none of thestdio
functions are ever used. If you are running out of space, defineMBINO_CONF_PLATFORM_STDIO
to0
inmbed_config.h
to disablestdio
support. -
Since the default AVR Libc
printf()
family of functions does not support floating point conversions, floating point values cannot be used withprintf()
,Serial::printf()
orRawSerial::printf()
. -
For portability (and so
millis()
and PWM still work), the Ticker API uses theTimer0
comparison register for generating ticker interrupts. Therefore,Ticker
only provides a resolution of about one millisecond. -
The
PwmOut::period()
andPwmOut::pulsewidth()
methods are only supported for PWM pins controlled by 16-bit timers, e.g. pins 9 and 10 on the Arduino Uno. For now, these methods are ignored for all other pins. Note that setting a period for one pin will also affect other pins controlled by the same timer. -
To avoid ambiguities with Arduino's own global
Serial
object, you have to use the fully qualified class namembed::Serial
when using the mbed Serial API. -
Keep in mind that you are still developing for an 8-bit platform, so only 8-bit variables can be read atomically, e.g. when passing data between an ISR and your main program. Also note that
int
on AVR is only 16 bits wide - that's why some APIs, such as those takingbaud
orhz
parameters have been changed fromint
tolong
.
Copyright (c) 2017, 2018 Thomas Kemmer
mbed Microcontroller Library Copyright (c) 2006-2018 ARM Limited
Licensed under the Apache License, Version 2.0.