Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by Dunning-Kruger!

Easydriver Code Nema 17 Motor Driver With Io-Tiny

I am driving a SparkFun EasyDriver Nema 17 Motor Driver board with an iO-Tiny
All are powered with a 6V SLA
When I first connect to the Tiny with ARC the motor begins a slow spin.
When I run the code below the motor stops as desired.

Code:


SET(D0,OFF) // step pin
SET(D1,OFF) // dir pin

When I run the loop, converted from an Arduino Sketch to this, get the motor running again, nothing happens. I get Start and Done messages on the script, but no printout of x or movement of the stepper motor. Any ideas?

Code:


$x = 0
:loop

$x = $x + 1
SET(D1,OFF) // dir pin (maintain current direction)
SET(D0,ON) // step pin
Sleep(3)
SET(D0,OFF) // step pin
Sleep(3)

print($x) // let me know the loop progress
if($x = 6400) { $x = 0 } // don't go crazy

goto loop

AI Support Bot
Related Content
Synthiam
#1  
Your ez script has syntax errors... try this and understand your sleeps are very short so this script will loop quite quickly

Code:


$x = 0
:loop

$x = $x + 1
SET(D1,OFF) # dir pin (maintain current direction)
SET(D0,ON) # step pin
Sleep(3)
SET(D0,OFF) # step pin
Sleep(3)

print($x) # let me know the loop progress
if($x = 6400)
$x = 0 # don't go crazy
endif

goto loop
#2  
Thanks Richard. I added the missing endif and got rid of the { }
Now I get the error message:

my_script_name (STEPPER)
STEPPER - Error: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
STEPPER - Done (00:00:00)
#3  
My bad goto loop must be in brackets.. as below

Code:


goto(loop)
#4  
Bingo - Thanks!
I do one hell of a lot of programming in php so I've got that syntax on the brain.
Best!
Stephen