Next: Arduino Sensors, Previous: Arduino Ultrasonic Functions, Up: Function Reference [Contents][Index]
Create an addon object using the addon named class.
ar - connected arduino object
addonname - the name of the addon to create. The addon name can be a user addon or an inbuilt addon, however must appear in the listArduinoLibraries output and have been programmed onto the arduino.
varargs - optional values that will be provided verbatim to the the addon class constructor.
retval - cell array of string library names.
See also: arduino, arduinosetup, listArduinoLibraries.
EEPROM addon for arduino
Allows read and write of uint8 data to the onboard arduino EEPROM.
Assuming eeprom addon has been programmed into the Arduino:
a = arduino (); e = addon (a, "eepromaddon/eeprom"); write (e, 0, uint8("hello world")); str = uint8( read(e, 0, 11) )
See also: addon.
length - Size of the EEPROM.
Constructor to create EEPROM device.
eeprom - created EEPROM device.
Erase all values in EEPROM (Effectively setting the 0xFF)
Write data to EEPROM at the provided address.
address - start address to write data to, should be an integer between 0 and the size of the EEPROM.
uintdata a value or array of uint8 data to write to EEPROM.
Read data from starting address of EEPROM.
address - start address to read data from, should be an integer between 0 and the size of the EEPROM.
count - Number of uint8 values to read from the EEPROM (default is 1)
data a value or array of uint8 data read from the EEPROM.
Basic Example matlab/octave code to illustrate creating a user addon.
See also: addon.
Parent - the parent arduino object.
Pins - the pins allocated the addon.
Constructor to create Echo addon
arObj - the arduino parent object
obj - created Echo object
Send text to arduino and receive back the echoed reply
text - text to send to arduino
response - response from the arduino, which should be the same as the input text.
Basic Example octave addon for LCD
Allows basic manipulation of an LCD as a illustration of using the addon functionality.
Assuming the arduino has been programmed with the lcd addon:
a = arduino(); lcd = addon(a, "examplelcd/lcd", "d8", "d9", "d4", "d5", "d6", "d7") clearLCD(lcd); printLCD(lcd, "Hello"); # go to next line gotoLCD(lcd, 0, 1); printLCD(lcd, "World");
See also: addon.
Pins - the pins allocated the LCD display.
Constructor to create LCD device
arObj - the arduino parent object
rs - the pin to use for the rs line.
enable - the pin to use for the enable line.
d0 - the pin to use for the d0 line.
d1 - the pin to use for the d1 line.
d2 - the pin to use for the d2 line.
d3 - the pin to use for the d3 line.
lcd - created LCD object
Free the LCD
Should be called before discarding the LCD
None.
None.
Clear the LCD display and set the cursor position to the home position.
None.
None.
Display text on LCD starting at the current cursor position.
text - text to display on LCD
None.
Set the cursor position to row, col
col - 0 indexed LCD column to position to.
row - 0 indexed LCD row to position to.
None.
DS1307 addon
See also: addon.
Parent - the parent arduino object.
Pins - the pins allocated the addon.
Constructor to create DS1307 addon
arObj - the arduino parent object
propertyname, propertyvalue - optional property name, value pairs. Current known properties are:
I2C address of the DS1307 (default 0x68)
obj - created DS1307 object
a = arduino()
rtc = addon(a, "rtcaddon/ds1307")
Get/set the DS1307 clock
dsObj - the ds1307 object
date - a date vector in same format as datevec and clock
date - a date vector in same format as datevec and clock
a = arduino()
rtc = addon(a, "rtcaddon/ds1307")
# get and display rtc time as a date string
datestr(rtc.clock)
See also: datevec.
Get/set the DS1307 clock
dsObj - the ds1307 object
ctrl - a structure containing the control bit fields.
ctrl - a structure containing the control bit fields.
Control structure fields are: Current properties are:
Out bit in the control register
Square wave enable bit in control register
The combined RS0, RS1 value
Get whether the RTC clock is currently counting time
dsObj - the ds1307 object
YN - returns true if the RTC is counting
See also: start, stop.
Start the RTC counting
dsObj - the ds1307 object
None
See also: datevec.
Stop the RTC counting
dsObj - the ds1307 object
None
See also: datevec.
Stepper class for stepper control using ULN2003 and compatible drivers
Id of the stepper (Read only)
Number of steps to do per second.
Status of stepper (Read only). 0 = not moving, 1 = moving, 2 = rotating
the Arduino parent (read only)
the pins used for the stepper (read only)
Constructor to create a stepper object
aObj - The arduino
pin1 - The first pin of the controller
pin2 - The second pin of the controller
pin3 - The third pin of the controller
pin4 - The fourth pin of the controller
pin5 - The fifth pin of the controller
s - a simplestepper object
a = arduino()
# create stepper object
s = addon(a, "simplestepper/simplestepper", "d2", "d3", "d4", "d5")
# start rotating left
s.rotate(-1);
See also: addon.
Move the motor the specified number of steps using the configured Speed.
sObj - the stepper object
steps - the number of steps to move. steps less than 0 will be moving left.
None
See also: rotate.
Start steppermotor moving in the specified direction using the configured Speed.
sObj - the stepper object
dir - Direction to move. -1 = left, 0 = stop, 1 = right.
None
See also: move.
Release this stepper motor
sObj - the stepper object
None
DC Motor class for dc motor control on the adafruit motor shield
See also: arduinoioaddons.adafruit.motorshieldv2.
Speed - The speed value set for the motor
Parent - The parent shield for object (read only)
MotorNumber - The motor number (read only) values 1-4
IsRunning - boolean for if the motor is started (read only)
Constructor to create dcmotor object
mObj - the motor shield object
mnum - The motor number (1 - 4)
propertyname, propertyvalue - Optional property name/value pairs to pass to motor object.
Current known properties are:
Initial speed (default 0). Should be a value between -1 and 1.
s - a dcmotorv2 object
a = arduino()
ms = addon(a, "adafruit/motorshieldv2")
mtr = dcmotor(ms, 1)
Start the motor moving in previously set speed/direction
dcObj - the dcmotor object
None
See also: adafruit.motorshieldv2.
Stop the motor moving
dcObj - the dcmotor object
None
See also: adafruit.motorshieldv2.
Adafruit motor shield addon
See also: addon.
Parent - the parent arduino object.
Pins - the pins allocated the addon.
I2CAddress - the i2c address used for accessing this shield.
PWMFrequency - the set PWM frequency for this shield.
Constructor to create motorshieldv2 addon object
arObj - the arduino parent object
propertyname, propertyvalue - optional property name, value pairs. Current known properties are:
I2C address of the motor shield (default 0x60)
PWM Frequency to set on shield (default 1600)
obj - created motorshieldv2 object
a = arduino()
mtr = addon(a, "adafruit/motorshieldv2")
Create a servo object
mObj - the motor shield object
mtrnum - The servo motor number, where 1 is servo on pin "d10" and 2 is a servo on pin "d9"
propertyname, propertyvalue - Optional property name/value pairs to pass to servo object.
Properties are the same as the base servo object.
s - a servo object
a = arduino()
ms = addon(a, "adafruit/motorshieldv2")
# get servo 1 (servo on pin D10)
s = ms.servo(1)
The function if the equivalent of calling the arduino.servo with the D9 or D10 pin has the input pin.
See also: servo.
Create a stepper motor object
mObj - the motor shield object
mtrnum - The stepper motor number (1 or 2)
stepsperrev - Number of steps per revolution.
propertyname, propertyvalue - Optional property name/value pairs to pass to stepper object.
s - a stepper object
Create a dcmotor motor object
mObj - the motor shield object
mtrnum - The motor number (1 - 4)
propertyname, propertyvalue - Optional property name/value pairs to pass to motor object.
s - a dcmotorv2 object
Stepper class for stepper control on the adafruit motor shield
See also: arduinoioaddons.adafruit.motorshieldv2.
The rpm value set for the stepper motor
the StepType for the stepper (string) which can be "single", "double", "interleave" or "microstep"
the StepsPerRevoluion for the stepper (read only)
the motor number for the stepper (read only) value will be 1 or 2.
the parent shield of this stepper (read only)
Constructor to create dcmotor object
mObj - the motor shield object
mnum - The motor number (1 or 2)
stepsperrev - Number of steps per revolution.
propertyname, propertyvalue - Optional property name/value pairs to pass to motor object.
Current known properties are:
the RPM for the stepper (revolutions per minute)
the StepType for the stepper (string) which can be "single", "double", "interleave" or "microstep"
s - a stepper object
a = arduino()
ms = addon(a, "adafruit/motorshieldv2")
mtr = stepper(ms, 1, 200)
Move the motor moving in the specified steps using the configured RPM.
sObj - the stepper object
None
See also: adafruit.motorshieldv2.
Release this motor
sObj - the stepper object
None
See also: adafruit.motorshieldv2.
Next: Arduino Sensors, Previous: Arduino Ultrasonic Functions, Up: Function Reference [Contents][Index]