Arduino

Using Arduino is an interesting option because it allows DUELink to be used in 2 very different ways. One option is to tether an Arduino-compatible board to control one DUELink Module or a chain of daisylinked DUELink modules.

The other option is to program any DUELink module using the Arduino IDE/software to run Standalone. For example, use Arduino IDE/software to control Ghizzy.

You can also combine both options and tether a standalone arduino-running DUELink Module to other DUELink modules! In this example, we have a DueDuino loaded with Arduino software that is tethered to a dasylink of DUELink modules.

Modules' product pages includes Arduino samples for both Tethered and Standalone options.
Tethered
Any board running Arduino software can be tethered to DUELink modules using a commonly-used JST connector. An example can be Arduino Uno R4 WiFi.

The Sparkfun Redboard Qwiic is another option.

Arduino-shaped boards, such as Arduino UNO, that do not have a JST connector can utilize DueShield. It has a Downlink connector plus an area with holes matrix for mounting DUELink modules.

You can also use the Breakout module to wire the connections using either I2C or UART.

When using I2C, pull-up resistors are required. If your board doesn't have them, we have a PullUp module for you.

To command and control tether DUELink modules, you need to install the DUELink Arduino library.
Under Tools on the top menu of the Arduino IDE select Manage Libraries.

Navigate to Boards Manager and Type STM in the search window and then click Install on both DUELink & STM32 MCU based boards packages.

Now let's connect any 2 DUELink modules to the Downlink port. This example code will blink both STAT LEDs on both modules. Note how the STAT LED of the first module blinks only 10 times while the second module blinks forever.
#include <DUELink.h>
SerialTransport transport(Serial2);
DUELink duelink(transport);
void setup() {
Serial.begin(9600);
Serial2.begin(115200);
duelink.Connect();
duelink.Engine.Select(1);//Selects the first DUELink Module
duelink.System.StatLed(200, 200, 10);//Blink STAT 1st module 10x
duelink.Engine.Select(2);//Selects the second DUELink Module
duelink.System.StatLed(200, 200, 0);//Blinks STAT 2nd Module forever
}
void loop(){
}
Here is another example that uses Arduino UNO 4 WIFI with an OLED 0.96 Display, a Button, and a Buzzer modules. Pressing the button generates sound on the buzzer, with the display showing some info.

#include "DUELink.h"
// This example runs on Arduino UNO 4 WIFI
// Device 1 is Display OLDE 0.96
// Device 2 is button
// device 3 is buzzer
TwoWireTransport transport(Wire1);
DUELink duelink(transport);
void setup() {
Serial.begin(9600);
Wire1.begin();
duelink.Connect();
duelink.Engine.Select(1);
duelink.Graphics.Clear(1);
duelink.Graphics.Text("--DUELink--", 0, 10, 1);
duelink.Graphics.Text("Press button on", 0, 1, 21);
duelink.Graphics.Text("device 2 to play", 0, 1, 31);
duelink.Graphics.Text("sound on device 3", 0, 1, 41);
duelink.Graphics.Show();
duelink.Engine.Select(2);
duelink.Button.Enable(1, 1, 1);
}
void loop() {
delay(100);
duelink.Engine.Select(2);
if (duelink.Button.Up(1) == 1) {
duelink.Engine.Select(3);
duelink.Frequency.Write(7, 1000, 50, 0.5);
}
}
Simple commands can do complex tasks, such as graphics in this case. This is possible because tethered DUELink modules are preloaded with the standard DUELink engine and are also loaded with appropriate drivers.
Standalone
Any DUELink module can run standalone using the Arduino software, replacing the default DUELink firmware. An example can be DueDuino.

Or a Ghizzy!

If the module you want to use does not have a USB connector, then you need a USB Hook or a similar module.

The micro used on all DUELink modules is STM32C071, which is fully supported by the Arduino IDE, through the ST extension. But wait, we did not just leave it at that! We have a board support package for you.
Arduino standalone samples for DUELink modules are provided in their individual product pages. These make for a great starting point.
Start the Arduino IDE. Under File, navigate to Preferences then click Additional boards manager URLs: icon. In the new window, copy and add both URLs below then click Ok.
https://github.com/ghi-electronics/duelink-libraries/raw/main/arduino/BoardManager/package_duelink_index.json
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

After the URLs have been added we can now add the "board". Select the Board Manager Icon from the side menu and search for duelink then click Install.

Finally we need to select the newly install board. Under Tools select Board:, then select DUELink.

Add this code to blink the status LED, which is connected to pin PB8.
void setup() {
// initialize digital pin as an output.
pinMode(PB8, OUTPUT);
}
void loop() {
digitalWrite(PB8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(PB8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Use the Arduino Verify button to make sure the IDE is able to compile your program.

If all went well, you will see something like this:
Sketch uses 44608 bytes (34%) of program storage space. Maximum is 131072 bytes.
Global variables use 1820 bytes (7%) of dynamic memory, leaving 22756 bytes for local variables. Maximum is 24576 bytes.
USB DFU (Device Firmware Update) is used to load the compiled program.

To load the Arduino program onto the DUELink module, put the board in loader mode (DFU) mode. This is done by holding LDR or "A" button down while resetting the board.

Modules that do not have buttons will include a 2-hole-pad (BOOT0 - 3.3V). Use a paper clip (or a wire) to short the two pads. Reset the board by cycling power then remove the paper clip.

You can verify the board is in DFU mode by checking the device manager.

In order for the Arduino IDE to be able to DFU load programs onto the module, it relies on a tool from ST Micro. Go ahead and install STM32CubeProgrammer from ST Micro.
Once STM32CubeProgrammer is installed, click on the Upload arrow, this will compile the sketch file and upload it to the device.

The generic example code above uses STAT LED, which is found on all modules. After you have that LED blinking, visit your module's product page for a specific Standalone sample for Arduino to get you started.
Theory of Operation
Loading Arduino software onto any DUELink module, turns it into an Arduino board. You will need to rely on the provided board schematics and the standard Arduino libraries for using the module itself. When a chain of modules are used, the first one will be running Arduino software standalone, we will call it a "Host". All other modules are tethered and will must continue to run the standard DUElink firmware. These tethered modules have the usual DUELink addressing, but the host (DueDuino in this example) does not have an address.

In comparison, when Arduino is not used, and the host is a PC for example, DueDuino has an address like any other module, because it is not the host. You can now use a coding language, like Python, on the PC to control IOs on DueDuino and the other modules.

Any module can run Arduino standalone. We are using DueDuino here for demonstration purposes.