diff --git a/examples/mbed/mbed-serial/README.rst b/examples/mbed/mbed-serial/README.rst new file mode 100644 index 00000000..5ea1282a --- /dev/null +++ b/examples/mbed/mbed-serial/README.rst @@ -0,0 +1,21 @@ +How to buid PlatformIO based project +==================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/mbed/mbed-serial + + # Process example project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/mbed/mbed-serial/platformio.ini b/examples/mbed/mbed-serial/platformio.ini new file mode 100644 index 00000000..f1f25ccb --- /dev/null +++ b/examples/mbed/mbed-serial/platformio.ini @@ -0,0 +1,43 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + + +# NXP LPC Platform +[env:lpc1768] +platform = nxplpc +framework = mbed +board = lpc1768 + +# Nordic nRF51 Platform +[env:nrf51_mkit] +platform = nordicnrf51 +framework = mbed +board = nrf51_mkit + +# Freescale FRDM Platform +[env:frdm_kl25z] +platform = freescalekinetis +framework = mbed +board = frdm_kl25z + +# ST STM32 Platform +[env:nucleo_f401re] +platform = ststm32 +framework = mbed +board = nucleo_f401re diff --git a/examples/mbed/mbed-serial/src/main.cpp b/examples/mbed/mbed-serial/src/main.cpp new file mode 100644 index 00000000..132ba174 --- /dev/null +++ b/examples/mbed/mbed-serial/src/main.cpp @@ -0,0 +1,10 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx + +int main() { + pc.printf("Hello World!\n\r"); + while(1) { + pc.putc(pc.getc() + 1); // echo input back to terminal + } +} \ No newline at end of file