MotoTwin

![]() | ![]() | ![]() | ![]() |
Dual motor controller
- Overview
- Drivers
- Samples
- Projects
Dual motor controller
Key features • Screw terminal connections | Resources |
Function | Description |
---|---|
Init() | Initialize device |
SMotorA(s, d, r) | Set Motor A. s: Speed, range 0..100, d: Duration in ms, 0 forever, r: 0: Normal - 1: Revert |
SMotorB(s, d, r) | Set Motor B. s: Speed, range 0..100, d: Duration in ms, 0 forever, r: 0: Normal - 1: Revert |
DVer() | This driver version. |
The Code!
Modules ship with this script preloaded. Use Console to reload or modify the drivers. Additionally, some languages, such as Python, include DUELink.Engine.Record()
for recording scripts directly from the host.
##### Driver Code Starts Here ###
# Pin 8: Sleep, active low
# Pin 9: Fault, active low
# Pin 4,5: A+, A-
# Pin 6,7: B+, B-
fn Init()
dwrite(8,1)
freq(4, 500, 0, 0)
freq(5, 500, 0, 0)
freq(6, 500, 0, 0)
freq(7, 500, 0, 0)
fend
fn SMotorA(s, d, r)
# s: speed in 0 to 100%
# d: duration in ms, 0: forever
# r: 0: Normal, 1: Revert
if (r = 0)
freq(5, 500, d, 0)
freq(4, 500, d, s / 100)
else
freq(4, 500, d, 0)
freq(5, 500, d, s / 100)
end
fend
fn SMotorB(s, d, r) # s: speed in 0 to 100, d: duration in ms, r: revert
if (r = 0)
freq(7, 500, d, 0)
freq(6, 500, d, s / 100)
else
freq(6, 500, d, 0)
freq(7, 500, d, s / 100)
end
fend
fn DVer()
return 0.1
fend
Init()
##### User Code Starts Here #####
- Script
- Python
- JavaScript
Use Console to modify the default driver by adding this sample.
# Append this code at the bottom of the script, right after the driver.
# You MUST keep the driver code!!
while 1
SMotorA(50, 10000, 0) # Set Motor A half speed in 10 seconds
SMotorB(50, 10000, 0) # Set Motor B half speed in 10 seconds
Wait(10000)
SMotorA(50, 10000, 1) # Set Motor A half speed in 10 seconds, revert
SMotorB(50, 10000, 1) # Set Motor A half speed in 10 seconds, revert
Wait(10000)
wend
from DUELink.DUELinkController import DUELinkController
import time
availablePort = DUELinkController.GetConnectionPort()
duelink = DUELinkController(availablePort)
//code
Coming soon!
Ordering Info
Description | Part Number | Price |
---|---|---|
MotoTwin | GDL-ACMOTOTWIN-A | $00.00 |