I remember to have had problems with the stepperfile to load on the arduino using the uno.
If I remember correctly, I had to remove the version extendsions.
this one:
#if defined(__SAM3X8E__)
void WriteToDAC(int _pin, int _value){
if(_pin == 0) analogWrite(DAC0, _value);
else if (_pin == 1) analogWrite(DAC1, _value);
}
#endif
from the firmata firmware. not sure this solves your problem though…
here you got some examples using libraries or no libraries alternatively:
…ok, I cna’t attcach .ino
…
noLib:
int delaylength = 500;
int delayPauseLength = 5000;
int steps = 100;
int n;
int m;
void setup() {
pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
pinMode(9, OUTPUT); //brake (disable) CH A
pinMode(8, OUTPUT); //brake (disable) CH B
}
void loop(){
switch(n){
case 0:
digitalWrite(9, LOW); //ENABLE CH A
digitalWrite(8, HIGH); //DISABLE CH B
digitalWrite(12, HIGH); //Sets direction of CH A
analogWrite(3, 255); //Moves CH A
n++;
m++;
if(m>steps){
m=0;
delay(delayPauseLength);
}
delay(delaylength);
case 1:
digitalWrite(9, HIGH); //DISABLE CH A
digitalWrite(8, LOW); //ENABLE CH B
digitalWrite(13, LOW); //Sets direction of CH B
analogWrite(11, 255); //Moves CH B
n++;
m++;
if(m>steps){
m=0;
delay(delayPauseLength);
}
delay(delaylength);
case 2:
digitalWrite(9, LOW); //ENABLE CH A
digitalWrite(8, HIGH); //DISABLE CH B
digitalWrite(12, LOW); //Sets direction of CH A
analogWrite(3, 255); //Moves CH A
n++;
m++;
if(m>steps){
m=0;
delay(delayPauseLength);
}
delay(delaylength);
case 3:
digitalWrite(9, HIGH); //DISABLE CH A
digitalWrite(8, LOW); //ENABLE CH B
digitalWrite(13, HIGH); //Sets direction of CH B
analogWrite(11, 255); //Moves CH B
n=0;
m++;
if(m>steps){
m=0;
delay(delayPauseLength);
}
delay(delaylength);
}
}
here using stepper.h as library:
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on the motor shield
Stepper myStepper(stepsPerRevolution, 12,13);
// give the motor control pins names:
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;
int x = 0;
void setup () {
Serial.begin(9600);
// set the PWM and brake pins so that the direction pins // can be used to control the motor:
pinMode(pwmA, OUTPUT);
pinMode(pwmB, OUTPUT);
pinMode(brakeA, OUTPUT);
pinMode(brakeB, OUTPUT);
digitalWrite(pwmA, HIGH);
digitalWrite(pwmB, HIGH);
digitalWrite(brakeA, LOW);
digitalWrite(brakeB, LOW);
// initialize the serial port:
Serial.begin(9600);
// set the motor speed (for multiple steps only):
myStepper.setSpeed(200);
} void loop () {
myStepper.step(200);
myStepper.step(-200);
delay(2000);
}
further it’s important to see that there is a quad stepper motor stream and a write component, as well as two different firmatas respectively. I guess that’s what Bruce is asking in his second question.
also there are several types of stepper drivers or modes respectively. you can have direction and steps (e.g. sparkfun) or some h-bridge where you’d control each coil “yourself”. If you want it to simply work, I’d strongly recommend the sparkfun stepper driver from the image coming with firefly. It worked pretty good for me.
you seem to be trying to combine them together, which demands for another kind of firmata than the provided ones, like Bruce pointed out. the text string providing the arduino with information from firefly needs to be deciphered to be converted into something that makes sense for arduino and it’s firmata logic.