Library to allow the use of Arduino specific language with the mbed

Dependents:   Gameduino Factory_monitor_0v1 mbed_mindflex NEW_NFC_TEST

Embed: (wiki syntax)

« Back to documentation index

arduino.c File Reference

arduino.c File Reference

Go to the source code of this file.

Functions

void timer_start (void)
 start the arduino_timer timer for millis() and micros() running.
long millis (void)
 return a long for the amount of time since the timer was started in milliseconds.
long micros (void)
 return a long for the amount of time since the timer was started in microseconds.
int random (int number)
 generates a random number from 0 to defined number
int random (int numberone, int numbertwo)
 generates a random number between two numbers
byte lowByte (short int low)
 returns the lower nibble of first byte
byte highByte (short int high)
 returns the higher nibble of first byte

Detailed Description

LICENSE

Copyright (c) 2012

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

DESCRIPTION

This is a library for allowing the use of programs written for the Arduino with the mbed. This was started for use with the Gameduino shield Library. It is currently uncomplete and not fully tested, but I don't see myself spending time on it. See TODOs and check http://arduino.cc/en/Reference/HomePage for missing parts

Example:

 #include "mbed.h"
 #include "arduino.h "
 
 void setup(){
 // setup code
 }

 *void loop(){
 // loop code
 *}

 int main() {
   timer_start();
   setup();
   while(1) {
       loop();
   }
 }

Definition in file arduino.c.


Function Documentation

byte highByte ( short int  high )

returns the higher nibble of first byte

Parameters:
highbyte of which the high nibble is required

Definition at line 208 of file arduino.c.

byte lowByte ( short int  low )

returns the lower nibble of first byte

Parameters:
highbyte of which the high nibble is required

Definition at line 199 of file arduino.c.

long micros ( void   )

return a long for the amount of time since the timer was started in microseconds.

Parameters:
void

Definition at line 114 of file arduino.c.

long millis ( void   )

return a long for the amount of time since the timer was started in milliseconds.

Parameters:
void

Definition at line 107 of file arduino.c.

int random ( int  number )

generates a random number from 0 to defined number

Parameters:
numbermaximum value for random number

Definition at line 154 of file arduino.c.

int random ( int  numberone,
int  numbertwo 
)

generates a random number between two numbers

Parameters:
numberoneminimum value for random number
numbertwomaximum value for random number

Definition at line 162 of file arduino.c.

void timer_start ( void   )

start the arduino_timer timer for millis() and micros() running.

Parameters:
void

Definition at line 100 of file arduino.c.