1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 01:09:47 +01:00
RIOT/examples/arduino_hello-world
2024-11-25 16:17:20 +01:00
..
hello-world.sketch examples/arduino_hello-world: fix buffer overflow 2024-11-25 16:16:48 +01:00
Makefile examples/arduino_hello-world: this example needs stdin 2024-11-25 16:17:20 +01:00
Makefile.ci examples: skip nucleo-l011k4 where it doesn't fit 2020-10-15 18:52:51 +02:00
README.md examples: added Arduino hello-world example 2015-11-27 12:45:12 +01:00

examples/arduino_hello-world

This application demonstrates the usage of Arduino sketches in RIOT.

The sketch itself is fairly simple. On startup, it initializes the LED pin to output mode, starts the serial port with a baudrate of 115200 and prints "Hello Arduino!" on the serial port. When running, the application echoes any newline terminated string that was received on the serial port, while toggling the default LED with a 1Hz frequency.

The sketch just uses some very primitive Arduino API elements for demonstration purposes:

  • control of digital pins (pinMode(), digital read and write)
  • the delay() function
  • reading and writing the serial port using the Serial class

Arduino and RIOT

For information on the Arduino support in RIOT please refer to the API documentation at http://doc.riot-os.org/group__sys__arduino.html

Usage

Just send any newline terminated string to the board's serial port, and the board will echo this string.

Example output

When using pyterm, the output will look similar to this:

2015-11-26 14:04:58,307 - INFO # main(): This is RIOT! (Version: xxx)
2015-11-26 14:04:58,308 - INFO # Hello Arduino!
hello again
2015-11-26 14:06:29,800 - INFO # Echo: hello again
are you still there?
2015-11-26 14:06:48,301 - INFO # Echo: are you still there?

If your board is equipped with an on-board LED, you should see this LED toggling every half a second.

NOTE: if your board's STDIO baudrate is not configured to be 115200 (see your board's board.h), the first line of the output may not be shown or scrambled.