Arduino Sketch:
Windows app (needs .NET Framework 4.5 or later):
http://ftp.vector.co.jp/72/56/2935/A_CTRL.zip
Android app:
How to start Windows app:
Before clicking "Start" button, please put COM# or a keyword in "Config" tab for app to find arduino.
Please refer to "Device Manager" to find COM# or the keyword. In the following example, Arduino is recognized as "USB-SERIAL CH340 (COM4)". Here, COM# is "COM4". And, for example, "CH340" can be used for the keyword.
Pin Assignment
D13 SCK
D12 MISO
D11 MOSI
D10 CS(SS)
D9 Clock out
D7-D6 Digital Input/Output
D5-D2 Digital Output
A5 SCL (No internal pull-up)
A4 SDA (No internal pull-up)
A1-A0 Analog Input
GND GND
For I2C:
A5 SCL (No internal pull-up)
A4 SDA (No internal pull-up)
GND GND
For SPI:
D13 SCK
D12 MISO
D11 MOSI
D10 CS(SS)
GND GND
For GPIO:
D7-D6: Digital Input/Output
D5-D2: Digital Output
A1-A0: Analog Input
GND GND
For Clock out:
D9 Clock out
GND GND
Format of Command:
Command for Android app and Windows app ("CMD" and "CMD_Multi" tab) contains a "command word" and some binary data in Hex, which are divided by a space.
command_word B0 B1 B2 ...
command_word:
"w" I2C write
"r" I2C read
"s" SPI read/write
"g" GPIO control
"p" repeat a preset GPO pattern
"c" Clock out control
"delay" insert delay
"//" comment out
B0, B1, B2,...:
Binay data (0 to 255) in Hex (00 to FF).
A command can be divided into multiple lines with "+".
w 24 00 01 02 03 ... FF
w 24 00 01 ... 0F
+ 10 11 ... 1F
...
+ F0 F1 ... FF
I2C / Write
Input Command:
w B0 B1 B2 ...
Output:
none
w: command_word
B0: 7-bit slave address (r/w bit is not necessary)
B1, B2, ...: writing data
Example: w 24 00 01 10 a0 FF
write 5-bytes (0x00 0x01 0x10 0xa0 0xFF) to slave address 0x24.
I2C / Read
Input Command:
r B0 B1 B2 ... Bz
Ouptput:
Reading data in Hex
r: command_word
B0: 7-bit slave address (r/w bit is not necessary)
B1, B2, ...: writing data (optional)
Bz: reading data length in Hex
Example: w 24 00 10
read 16-bytes data from slave address 0x24 registor address 0x00.
SPI
Input Command:
s B0 B1 B2 ...
Ouptput:
Reading data in Hex
s: command_word
B0[7:6]: 00 (fixed)
B0[5]: 0 = MSB First, 1 = LSB First
B0[4:2]: SPI Clock, 0 = (1/2) x Arduino CLK, 1 = (1/4) x Arduino CLK , ..., 6 = (1/128) x Arduino CLK
B0[1:0]: SPI mode, 0 = mode 0, 1 = mode 1, ..., 3 = mode 3
B1, B2, ...: writing data
Example: s 00 10 FF
write 2-bytes (0x10 0xFF) and read 2-bytes from a slave device with the setting of MSB First, SPI Clock = 8MHz (Arduino CLK=16MHz), SPI mode = 0.
GPIO
Input Command:
g B0 B1 B2 B3 ...
Ouptput:
State of each GPIO pin.
4-digital-outputs: D5-D2
2-digital-inputs/outputs: D7, D6
2-analog-inputs: A1, A0 (Arduino supply voltage x (n/1023))
g: command_word
B0, B1: Pulse width, B0 x 256 + B1 [msec]
B2[7]: 0 = D7 is in Input mode, 1 = D7 is in Output mode
B2[6]: 0 = D6 is in Input mode, 1 = D6 is in Output mode
B2[5]: 0 = D7 is Hi-Z (Input mode), D7 outputs Low (Output mode), 1 = D7 is Pulled-up (Input mode), D7 outputs High (Output mode)
B2[4]: 0 = D6 is Hi-Z (Input mode), D6 outputs Low (Output mode), 1 = D6 is Pulled-up (Input mode), D6 outputs High (Output mode)
B2[3]: 0 = D5 outputs Low, 1 =D5 outputs High
B2[2]: 0 = D4 outputs Low, 1 =D4 outputs High
B2[1]: 0 = D3 outputs Low, 1 =D3 outputs High
B2[0]: 0 = D2 outputs Low, 1 =D2 outputs High
B3, ...: has the same assignment with B2
Example: g 00 01 03 00 03 00
D3 and D2 output High/Low pulse with 1msec width twice and get state of D7-2, A1, A0. D7-6 are in Input mode (Hi-Z).
Repeat preset GPO pattern
Input Command:
p B0 B1
Ouptput:
none
p: command_word
B0: 0 = stop, 1 = start
B1: Repeat count, 0 = continuous
Example: p 01 00
D6-D2 outputs the same pattern set by the previous "g" command repeatedly.
The output is stopped by a command "p 00 00".
The states of D8, D7, A1, A0 are not obtained.
Clock out
Input Command:
c B0 B1 B2 B3
Ouptput:
none
c: command_word
B0, B1: Clock period, (B0 x 256 + B1) x (Arduino clock period)
B2, B3: High width, (B0 x 256 + B1) x (Arduino clock period)
Example: c 00 10 00 08
D9 outputs 1MHz, 50% duty clock. (in case Aruduino clock is 16MHz)
Delay
For "CMD_Multi" tab in Windows app and for Android app.
Input Command:
delay D0
Ouptput:
none
delay: command_word
D0: Delay time [msec] in DEC (not in Hex)
Example: delay 1000
wait 1000 msec
Comment out
For "CMD_Multi" tab in Windows app and for Android app.
Example: // w24 00 01
This command is ignored.