forked from platformio/platformio-core
Add serial port example with mbed framework
This commit is contained in:
21
examples/mbed/mbed-serial/README.rst
Normal file
21
examples/mbed/mbed-serial/README.rst
Normal 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
|
43
examples/mbed/mbed-serial/platformio.ini
Normal file
43
examples/mbed/mbed-serial/platformio.ini
Normal 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
|
10
examples/mbed/mbed-serial/src/main.cpp
Normal file
10
examples/mbed/mbed-serial/src/main.cpp
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user