Userspace Arduino:Libraries

From eLinux.org
Revision as of 01:26, 1 September 2013 by Meanbot (talk | contribs) (Functions : Wire)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page has a list of all the libraries and the functions that are supported by Userspace Arduino project.

Functions : Core Arduino

  • GREEN means implemented and tested
  • YELLOW means WIP and testing
  • RED means yet to implement
Description Status Group Notes
delay() Working Time No issues
delayMicroseconds() Working Time
pinMode() Working Digital I/O No issues
digitalRead() Working Digital I/O No issues
digitalWrite() Working Digital I/O No issues
analogRead() Working Analog I/O No issues
analogWrite() Working Analog I/O No issues
shiftOut() Working Advanced I/O No issues
shiftIn() Working Advanced I/O
min() Working Math
max() Working Math
abs() Working Math
constrain() Working Math
round() Working Math
radians() Working Math
degrees() Working Math
sq() Working Math
tone() WIP Advanced I/O
noTone() WIP Advanced I/O
pulseIn() WIP Advanced I/O
analogWriteResolution WIP Analog I/O
analogReadResolution WIP Analog I/O
millis() Time
micros() Time
map() Working Math
pow() Working Math
sqrt() Working Math
sin() Working Trigonometry
cos() Working Trigonometry
tan() Working Trigonometry
randomSeed() Working Random Numbers
random() Working Random Numbers
lowByte() Working Bits and Bytes
highByte() Working Bits and Bytes
bitRead() Working Bits and Bytes
bitWrite() Working Bits and Bytes
bitSet() Working Bits and Bytes
bitClear() Working Bits and Bytes
bit() Working Bits and Bytes
attachInterrupt() Interrupt
detachInterrupt() Interrupt
interrupts() Interrupt
noInterrupts() Interrupt

pinMode()

digitalRead()

digitalWrite()

analogRead()

analogWrite()

Functions : SPI

Description Status Notes
begin() WIP
end() WIP
setBitOrder() WIP
setClockDivider() WIP
setDataMode() WIP
transfer() WIP

Functions : Wire

Description Status Notes
begin() Working
requestFrom() Working
beginTransmission() Working
endTransmission() Working
write() Working
available() Working
read() Working
onReceive() WIP
onRequest() WIP

The library is under test and has been tested with the MPU-6050 sketch.
The onRequest() and onReceive functions are unlikely to be supported since the I2C userland drivers don't provide interrupt-oriented callbacks.

Functions : Serial

Functions : Stepper

Description Status Notes
Stepper() WIP
setSpeed() WIP
step() WIP

Sample Code

Following is a tutorial on how to use the STH-39D1126 stepper motor with the BeagleBone Black and the Userspace-Arduino library

/*
Based on Adafruit Arduino - Lesson 16. 
4 Wire stepper interface for STH-39D1126(1.8deg/step)
*/

#include <Stepper.h>

int in1Pin = 2;
int in2Pin = 4;
int in3Pin = 10;
int in4Pin = 11;

Stepper motor(200, in1Pin, in2Pin, in3Pin, in4Pin);  

void setup()
{
		pinMode(in1Pin, OUTPUT);
		pinMode(in2Pin, OUTPUT);
		pinMode(in3Pin, OUTPUT);
		pinMode(in4Pin, OUTPUT);
		motor.setSpeed(20);
}

void loop()
{
		motor.step(5);
		delay(2000);
}

Functions : Servo

Description Status Notes
attach() WIP
write() WIP
writeMicroseconds() WIP
read() WIP
attached() WIP
detach() WIP