Difference between revisions of "Userspace Arduino:Libraries"
(→Functions : Wire) |
|||
(47 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
This page has a list of all the libraries and the functions that are supported by Userspace Arduino project. | This page has a list of all the libraries and the functions that are supported by Userspace Arduino project. | ||
+ | ==Functions : Core Arduino== | ||
+ | *<span id="GREEN" style="color:#00FF00">GREEN</span> means implemented and tested | ||
+ | *<span id="YELLOW" style="color:#FFFF00">YELLOW</span> means WIP and testing | ||
+ | *<span id="RED" style="color:#FF0000">RED</span> means yet to implement | ||
+ | {|border="3" | ||
+ | |+ | ||
+ | !Description||Status||Group|| Notes | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Delay delay()]|| style="background:#00FF00" | Working|| Time|| No issues | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/DelayMicroseconds delayMicroseconds()]||style="background:#00FF00" | Working || Time || | ||
+ | |- | ||
+ | |[[#pinMode | pinMode()]]||style="background:#00FF00" | Working|| Digital I/O || No issues | ||
+ | |- | ||
+ | |[[#digitalRead | digitalRead()]]||style="background:#00FF00" | Working|| Digital I/O|| No issues | ||
+ | |- | ||
+ | |[[#digitalWrite | digitalWrite()]]||style="background:#00FF00" | Working|| Digital I/O|| No issues | ||
+ | |- | ||
+ | |[[#analogRead | analogRead()]]||style="background:#00FF00" | Working|| Analog I/O|| No issues | ||
+ | |- | ||
+ | |[[#analogWrite | analogWrite()]]||style="background:#00FF00" | Working|| Analog I/O|| No issues | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ShiftOut shiftOut()]||style="background:#00FF00" | Working||Advanced I/O|| No issues | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ShiftIn shiftIn()]||style="background:#00FF00" | Working ||Advanced I/O || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Min min()]||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Max max()]||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Abs abs()]||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Constrain constrain()]||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |round()||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |radians()||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |degrees()||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |sq()||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |tone()|| style="background:yellow" | WIP ||Advanced I/O || | ||
+ | |- | ||
+ | |noTone()||style="background:yellow" | WIP ||Advanced I/O || | ||
+ | |- | ||
+ | |pulseIn() ||style="background:yellow" | WIP ||Advanced I/O || | ||
+ | |- | ||
+ | |analogWriteResolution||style="background:#00FF00" | WIP|| Analog I/O || | ||
+ | |- | ||
+ | |analogReadResolution||style="background:#00FF00" | WIP|| Analog I/O || | ||
+ | |- | ||
+ | |millis()|| style="background:red" | || Time || | ||
+ | |- | ||
+ | |micros()||style="background:red" | || Time || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Map map()]||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Pow pow()]||style="background:#00FF00" | Working|| Math || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Sqrt sqrt()] ||style="background:#00FF00" | Working || Math || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Sin sin()]||style="background:#00FF00" | Working || Trigonometry || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Cos cos()]||style="background:#00FF00" | Working || Trigonometry || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Tan tan()] ||style="background:#00FF00" | Working|| Trigonometry || | ||
+ | |- | ||
+ | |randomSeed()||style="background:#00FF00" | Working || Random Numbers || | ||
+ | |- | ||
+ | |random() ||style="background:#00FF00" | Working || Random Numbers || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/LowByte lowByte()]||style="background:#00FF00" | Working || Bits and Bytes || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/HighByte highByte()]||style="background:#00FF00" | Working || Bits and Bytes || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/BitRead bitRead()]||style="background:#00FF00" | Working|| Bits and Bytes || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/BitWrite bitWrite()]||style="background:#00FF00" | Working || Bits and Bytes || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/BitSet bitSet()]||style="background:#00FF00" | Working|| Bits and Bytes || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/BitClear bitClear()]||style="background:#00FF00" | Working || Bits and Bytes || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/Bit bit()]||style="background:#00FF00" | Working || Bits and Bytes || | ||
+ | |- | ||
+ | |attachInterrupt()||style="background:red" | || Interrupt || | ||
+ | |- | ||
+ | |detachInterrupt()||style="background:red" | || Interrupt || | ||
+ | |- | ||
+ | |interrupts()|| style="background:red" | || Interrupt || | ||
+ | |- | ||
+ | |noInterrupts() ||style="background:red" | || Interrupt || | ||
+ | |} | ||
+ | ===<span id="pinMode">pinMode()</span>=== | ||
+ | ===<span id="digitalRead">digitalRead()</span>=== | ||
+ | ===<span id="digitalWrite">digitalWrite()</span>=== | ||
+ | ===<span id="analogRead">analogRead()</span>=== | ||
+ | ===<span id="analogWrite">analogWrite()</span>=== | ||
+ | |||
+ | ==Functions : SPI == | ||
+ | {|border="3" | ||
+ | |+ | ||
+ | !Description||Status|| Notes | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/SPIBegin() begin()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/SPIEnd() end()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/SPISetBitOrder() setBitOrder()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/SPISetClockDivider() setClockDivider()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/SPISetDataMode() setDataMode()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/SPITransfer() transfer()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ==Functions : Wire == | ||
+ | {|border="3" | ||
+ | |+ | ||
+ | !Description||Status|| Notes | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireBegin begin()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireRequestFrom requestFrom()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireBeginTransmission beginTransmission()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireEndTransmission endTransmission()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireWrite write()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireAvailable available()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireRead read()]|| style="background:#00FF00" | Working || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireOnReceive onReceive()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/WireOnRequest onRequest()]|| style="background:yellow" | WIP || | ||
+ | |||
+ | |- | ||
+ | |} | ||
+ | The library is under test and has been tested with the [http://playground.arduino.cc/Main/MPU-6050 MPU-6050] sketch. | ||
+ | <br />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 == | ||
+ | {|border="3" | ||
+ | |+ | ||
+ | !Description||Status|| Notes | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/StepperConstructor Stepper()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/StepperSetSpeed setSpeed()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/StepperStep step()]|| style="background:yellow" | 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 | ||
+ | <pre> | ||
+ | /* | ||
+ | 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); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ==Functions : Servo == | ||
+ | {|border="3" | ||
+ | |+ | ||
+ | !Description||Status|| Notes | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ServoAttach attach()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ServoWrite write() ]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ServoWriteMicroseconds writeMicroseconds() ]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ServoRead read()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ServoAttached attached()]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |[//arduino.cc/en/Reference/ServoDetach detach() ]|| style="background:yellow" | WIP || | ||
+ | |- | ||
+ | |} | ||
+ | <br/> | ||
+ | *[[Userspace_Arduino]] | ||
+ | *[[Userspace_Arduino:To Do]] | ||
+ | <br/> | ||
[[Category:Arduino]] | [[Category:Arduino]] | ||
[[Category: RaspberryPi]] | [[Category: RaspberryPi]] |
Latest revision as of 01:26, 1 September 2013
This page has a list of all the libraries and the functions that are supported by Userspace Arduino project.
Contents
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 |