Arduino API

Implementation of the Arduino API in RIOT. More...

Detailed Description

Implementation of the Arduino API in RIOT.

Files

file  arduino.hpp
 Main interface definition of the Arduino API.
 
file  serialport.hpp
 Definition of the Arduino 'Serial' interface.
 

Macros

#define ARDUINO_UART_DEV   UART_DEV(0)
 UART device to use for Arduino serial.
 

Enumerations

enum  { INPUT, OUTPUT, INPUT_PULLUP }
 Possible pin configurations. More...
 
enum  { LOW = 0, HIGH = 1 }
 Possible pin states. More...
 

Functions

void pinMode (int pin, int mode)
 Configure a pin as either input or output. More...
 
void digitalWrite (int pin, int state)
 Set the value for the given pin. More...
 
int digitalRead (int pin)
 Read the current state of the given pin. More...
 
void delay (unsigned long msec)
 Sleep for a given amount of time [milliseconds]. More...
 
void delayMicroseconds (unsigned long usec)
 Sleep for a given amount of time [microseconds]. More...
 
unsigned long micros ()
 Returns the number of microseconds since start. More...
 
int analogRead (int pin)
 Read the current value of the given analog pin. More...
 

Variables

static SerialPort Serial (ARDUINO_UART_DEV)
 Primary serial port (mapped to ARDUINO_UART_DEV)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Possible pin configurations.

Enumerator
INPUT 

configure pin as input

OUTPUT 

configure pin as output

INPUT_PULLUP 

configure pin as input with pull-up resistor

Definition at line 34 of file arduino.hpp.

◆ anonymous enum

anonymous enum

Possible pin states.

Enumerator
LOW 

pin is cleared

HIGH 

pin is set

Definition at line 43 of file arduino.hpp.

Function Documentation

◆ analogRead()

int analogRead ( int  pin)

Read the current value of the given analog pin.

Parameters
[in]pinpin to read
Returns
a value between 0 to 1023 that is proportionnal to the voltage applied to the pin

◆ delay()

void delay ( unsigned long  msec)

Sleep for a given amount of time [milliseconds].

Parameters
[in]msecnumber of milliseconds to sleep

◆ delayMicroseconds()

void delayMicroseconds ( unsigned long  usec)

Sleep for a given amount of time [microseconds].

Parameters
[in]usecnumber of microseconds to sleep

◆ digitalRead()

int digitalRead ( int  pin)

Read the current state of the given pin.

Parameters
[in]pinpin to read
Returns
state of the given pin, HIGH or LOW

◆ digitalWrite()

void digitalWrite ( int  pin,
int  state 
)

Set the value for the given pin.

Parameters
[in]pinpin to set
[in]stateHIGH or LOW

◆ micros()

unsigned long micros ( )

Returns the number of microseconds since start.

Returns
value of microseconds since start

◆ pinMode()

void pinMode ( int  pin,
int  mode 
)

Configure a pin as either input or output.

Parameters
[in]pinpin to configure
[in]modemode to set the pin to