octave:2> test @arduino/arduino verbose
>>>>> /home/dima/.local/share/octave/api-v59/packages/arduino-0.12.1/@arduino/arduino.m
***** shared arduinos
arduinos = scanForArduinos(1);
***** assert(numel(arduinos), 1);
***** test
ar = arduino();
assert(!isempty(ar));
assert(ar.port, arduinos{1}.port);
assert(ar.board, arduinos{1}.board);
assert(numel(ar.availablepins) > 0);
***** test
ar = arduino(arduinos{1}.port);
assert(!isempty(ar));
assert(ar.port, arduinos{1}.port);
assert(ar.board, arduinos{1}.board);
***** test
ar = arduino(arduinos{1}.port, arduinos{1}.board);
assert(!isempty(ar));
assert(isa(ar, "arduino"))
assert(ar.port, arduinos{1}.port);
assert(ar.board, arduinos{1}.board);
***** test
ar = arduino();
# verify have compiled support for functions we will be testing
assert(!isempty(find(cellfun(@(x) strcmpi(x, "spi"), ar.libraries()), 1)))
assert(!isempty(find(cellfun(@(x) strcmpi(x, "i2c"), ar.libraries()), 1)))
assert(!isempty(find(cellfun(@(x) strcmpi(x, "servo"), ar.libraries()), 1)))
assert(!isempty(find(cellfun(@(x) strcmpi(x, "shiftregister"), ar.libraries()), 1)))
assert(!isempty(find(cellfun(@(x) strcmpi(x, "rotaryencoder"), ar.libraries()), 1)))
!!!!! test failed
assert (!isempty (find (cellfun (@(x)strcmpi (x, "rotaryencoder"), ar.libraries ()), 1))) failed
shared variables
arduinos =
{
[1,1] =
scalar structure containing the fields:
port = /dev/ttyUSB0
board = uno
}
octave:3> a = arduino ("/dev/ttyUSB0","","Debug", 1, "Baudrate", 9600)
>> 165 0 1 0
<< 165 0 1 7
<< 30 149 15 0 50 5 0
>> 165 0 8 1 0
<< 165 0 8 5
<< 0 67 111 114 101
>> 165 0 8 1 1
<< 165 0 8 4
<< 1 73 50 67
>> 165 0 8 1 2
<< 165 0 8 4
<< 2 83 80 73
>> 165 0 8 1 3
<< 165 0 8 6
<< 3 83 101 114 118 111
>> 165 0 8 1 4
<< 165 0 8 14
<< 4 83 104 105 102 116 82 101 103 105 115 116 101 114
a =
arduino object with fields of:
port = /dev/ttyUSB0
board = uno
libraries = {
i2c
spi
servo
shiftregister
}
availablepins = {
d0 - d13
a0 - a5
}
config =
board = uno
baudrate = 9600
mcu = atmega328p
voltref = 5
libs =
{
[1,1] =
scalar structure containing the fields:
id = 0
name = core
[1,2] =
scalar structure containing the fields:
id = 1
name = i2c
[1,3] =
scalar structure containing the fields:
id = 2
name = spi
[1,4] =
scalar structure containing the fields:
id = 3
name = servo
[1,5] =
scalar structure containing the fields:
id = 4
name = shiftregister
}
port = /dev/ttyUSB0
description = Arduino Uno R3 Board
pins =
{
[1,1] =
scalar structure containing the fields:
name = d0
id = 0
modes =
{
[1,1] = digital
[1,2] = uart
}
owner =
mode = unset
altnames = {}(0x0)
[1,2] =
scalar structure containing the fields:
name = d1
id = 1
modes =
{
[1,1] = digital
[1,2] = uart
}
owner =
mode = unset
altnames = {}(0x0)
[1,3] =
scalar structure containing the fields:
name = d2
id = 2
modes =
{
[1,1] = digital
[1,2] = interrupt
}
owner =
mode = unset
altnames = {}(0x0)
[1,4] =
scalar structure containing the fields:
name = d3
id = 3
modes =
{
[1,1] = digital
[1,2] = pwm
[1,3] = interrupt
}
owner =
mode = unset
altnames = {}(0x0)
[1,5] =
scalar structure containing the fields:
name = d4
id = 4
modes =
{
[1,1] = digital
}
owner =
mode = unset
altnames = {}(0x0)
[1,6] =
scalar structure containing the fields:
name = d5
id = 5
modes =
{
[1,1] = digital
[1,2] = pwm
}
owner =
mode = unset
altnames = {}(0x0)
[1,7] =
scalar structure containing the fields:
name = d6
id = 6
modes =
{
[1,1] = digital
[1,2] = pwm
}
owner =
mode = unset
altnames = {}(0x0)
[1,8] =
scalar structure containing the fields:
name = d7
id = 7
modes =
{
[1,1] = digital
}
owner =
mode = unset
altnames = {}(0x0)
[1,9] =
scalar structure containing the fields:
name = d8
id = 8
modes =
{
[1,1] = digital
}
owner =
mode = unset
altnames = {}(0x0)
[1,10] =
scalar structure containing the fields:
name = d9
id = 9
modes =
{
[1,1] = digital
[1,2] = pwm
}
owner =
mode = unset
altnames = {}(0x0)
[1,11] =
scalar structure containing the fields:
name = d10
id = 10
modes =
{
[1,1] = digital
[1,2] = pwm
[1,3] = spi0_ss
}
owner =
mode = unset
altnames = {}(0x0)
[1,12] =
scalar structure containing the fields:
name = d11
id = 11
modes =
{
[1,1] = digital
[1,2] = pwm
[1,3] = spi0_mosi
}
owner =
mode = unset
altnames = {}(0x0)
[1,13] =
scalar structure containing the fields:
name = d12
id = 12
modes =
{
[1,1] = digital
[1,2] = pwm
[1,3] = spi0_miso
}
owner =
mode = unset
altnames = {}(0x0)
[1,14] =
scalar structure containing the fields:
name = d13
id = 13
modes =
{
[1,1] = digital
[1,2] = pwm
[1,3] = spi0_sck
[1,4] = led
}
owner =
mode = unset
altnames = {}(0x0)
[1,15] =
scalar structure containing the fields:
name = a0
id = 14
modes =
{
[1,1] = digital
[1,2] = analog
}
owner =
mode = unset
altnames = {}(0x0)
[1,16] =
scalar structure containing the fields:
name = a1
id = 15
modes =
{
[1,1] = digital
[1,2] = analog
}
owner =
mode = unset
altnames = {}(0x0)
[1,17] =
scalar structure containing the fields:
name = a2
id = 16
modes =
{
[1,1] = digital
[1,2] = analog
}
owner =
mode = unset
altnames = {}(0x0)
[1,18] =
scalar structure containing the fields:
name = a3
id = 17
modes =
{
[1,1] = digital
[1,2] = analog
}
owner =
mode = unset
altnames = {}(0x0)
[1,19] =
scalar structure containing the fields:
name = a4
id = 18
modes =
{
[1,1] = digital
[1,2] = analog
[1,3] = i2c_sda
}
owner =
mode = unset
altnames = {}(0x0)
[1,20] =
scalar structure containing the fields:
name = a5
id = 19
modes =
{
[1,1] = digital
[1,2] = analog
[1,3] = i2c_scl
}
owner =
mode = unset
altnames = {}(0x0)
}
flags = 0
Dmitri.