Add serial port example with mbed framework

This commit is contained in:
Valeriy Koval
2015-03-16 12:12:13 +02:00
parent 57b84789c0
commit c536aca961
3 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,21 @@
How to buid PlatformIO based project
====================================
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
2. Download `source code with examples <https://github.com/ivankravets/platformio/archive/develop.zip>`_
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

View File

@ -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

View File

@ -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
}
}