author

Phoephoe

Inbox View Profile
5Comments

Tell us about yourself!

  • MICRO MIDI STEPPER touchOSC TIMELAPSE DOLLY

    A bit messy posting the code here I guess, but here goes ;)#include <MIDI.h>#include <Stepper.h>#include <Arduino.h>int pin = 13; //MIDI INbyte Acounter = 0;byte Bcounter = 0;byte Ccounter = 0;// MOTOR OUT beginint AmotA = 3;int AmotB = 4;int BmotA = 6;int BmotB = 7;int CmotA = 8;int CmotB = 9;Stepper Amot(800, 3, 4);Stepper Bmot(800, 6, 7);Stepper Cmot(800, 8, 9);// MOTOR OUT endMIDI_CREATE_DEFAULT_INSTANCE();void HandlecontorlChange(byte channel, byte number, byte value) // SEARCH FOR CC{ if (channel == 1) // SEARCH FOR MIDI Ch. 1 { if (number == 20) // FOR MIDID CC Ch 20 { if (value < Acounter) { Amot.step(-5); Acounter = value; // Serial.write(value); ...

    see more »

    A bit messy posting the code here I guess, but here goes ;)#include <MIDI.h>#include <Stepper.h>#include <Arduino.h>int pin = 13; //MIDI INbyte Acounter = 0;byte Bcounter = 0;byte Ccounter = 0;// MOTOR OUT beginint AmotA = 3;int AmotB = 4;int BmotA = 6;int BmotB = 7;int CmotA = 8;int CmotB = 9;Stepper Amot(800, 3, 4);Stepper Bmot(800, 6, 7);Stepper Cmot(800, 8, 9);// MOTOR OUT endMIDI_CREATE_DEFAULT_INSTANCE();void HandlecontorlChange(byte channel, byte number, byte value) // SEARCH FOR CC{ if (channel == 1) // SEARCH FOR MIDI Ch. 1 { if (number == 20) // FOR MIDID CC Ch 20 { if (value < Acounter) { Amot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value > Acounter) { Amot.step(+5); Acounter = value; digitalWrite(pin, HIGH); } else if (value == Acounter) { Amot.step(0); Acounter = value; digitalWrite(pin, HIGH); } } else if (number == 21) // FOR MIDID CC Ch 21 { if (value < Acounter) { Bmot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value > Acounter) { Bmot.step(+5); Acounter = value; digitalWrite(pin, HIGH); } else if (value == Acounter) { Bmot.step(0); Acounter = value; digitalWrite(pin, HIGH); } } else if (number == 22) // FOR MIDID CC Ch 22 { if (value < Acounter) { Cmot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value > Acounter) { Cmot.step(+5); Acounter = value; digitalWrite(pin, HIGH); } else if (value == Acounter) { Cmot.step(0); Acounter = value; digitalWrite(pin, HIGH); } } } else // WRONG MIDI CHANNEL { digitalWrite(pin, HIGH); } } //-------------------------------------------------------------------------------------- void setup() { pinMode(pin, OUTPUT); MIDI.setHandleControlChange(HandleControlChange); MIDI.begin(MIDI_CHANNEL_OMNI); //motor A pinMode(AmotA, OUTPUT); pinMode(AmotB, OUTPUT); //motor B pinMode(BmotA, OUTPUT); pinMode(BmotB, OUTPUT); //motor C pinMode(CmotA, OUTPUT); pinMode(CmotB, OUTPUT); //motorSpeed Amot.setSpeed(4); Bmot.setSpeed(4); Cmot.setSpeed(4); } void loop() { MIDI.read(); digitalWrite(pin, LOW); }

    #include <MIDI.h>#include <Stepper.h>#include <Arduino.h>int pin = 13; //MIDI INbyte Acounter = 0;byte Bcounter = 0;byte Ccounter = 0;// MOTOR OUT beginint AmotA = 3;int AmotB = 4;int BmotA = 6;int BmotB = 7;int CmotA = 8;int CmotB = 9;Stepper Amot(800, 3, 4);Stepper Bmot(800, 6, 7);Stepper Cmot(800, 8, 9);// MOTOR OUT endMIDI_CREATE_DEFAULT_INSTANCE();void HandlecontorlChange(byte channel, byte number, byte value) // SEARCH FOR CC{ if (channel == 1) // SEARCH FOR MIDI Ch. 1 { if (number == 20) // FOR MIDID CC Ch 20 { if (value < Acounter) { Amot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value ...

    see more »

    #include <MIDI.h>#include <Stepper.h>#include <Arduino.h>int pin = 13; //MIDI INbyte Acounter = 0;byte Bcounter = 0;byte Ccounter = 0;// MOTOR OUT beginint AmotA = 3;int AmotB = 4;int BmotA = 6;int BmotB = 7;int CmotA = 8;int CmotB = 9;Stepper Amot(800, 3, 4);Stepper Bmot(800, 6, 7);Stepper Cmot(800, 8, 9);// MOTOR OUT endMIDI_CREATE_DEFAULT_INSTANCE();void HandlecontorlChange(byte channel, byte number, byte value) // SEARCH FOR CC{ if (channel == 1) // SEARCH FOR MIDI Ch. 1 { if (number == 20) // FOR MIDID CC Ch 20 { if (value < Acounter) { Amot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value > Acounter) { Amot.step(+5); Acounter = value; digitalWrite(pin, HIGH); } else if (value == Acounter) { Amot.step(0); Acounter = value; digitalWrite(pin, HIGH); } } else if (number == 21) // FOR MIDID CC Ch 21 { if (value < Acounter) { Bmot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value > Acounter) { Bmot.step(+5); Acounter = value; digitalWrite(pin, HIGH); } else if (value == Acounter) { Bmot.step(0); Acounter = value; digitalWrite(pin, HIGH); } } else if (number == 22) // FOR MIDID CC Ch 22 { if (value < Acounter) { Cmot.step(-5); Acounter = value; // Serial.write(value); digitalWrite(pin, HIGH); } else if (value > Acounter) { Cmot.step(+5); Acounter = value; digitalWrite(pin, HIGH); } else if (value == Acounter) { Cmot.step(0); Acounter = value; digitalWrite(pin, HIGH); } } } else // WRONG MIDI CHANNEL { digitalWrite(pin, HIGH); } } //-------------------------------------------------------------------------------------- void setup() { pinMode(pin, OUTPUT); MIDI.setHandleControlChange(HandleControlChange); MIDI.begin(MIDI_CHANNEL_OMNI); //motor A pinMode(AmotA, OUTPUT); pinMode(AmotB, OUTPUT); //motor B pinMode(BmotA, OUTPUT); pinMode(BmotB, OUTPUT); //motor C pinMode(CmotA, OUTPUT); pinMode(CmotB, OUTPUT); //motorSpeed Amot.setSpeed(4); Bmot.setSpeed(4); Cmot.setSpeed(4); } void loop() { MIDI.read(); digitalWrite(pin, LOW); }

    Hi! Great tutorial!I'm pretty new to the arduino coding, so I guess my question is a pretty simple one ;)I'm using nema 17's with a pololu driver so I only use two pins for the motor,is there a chance you could point me on how to set up the counter and define the motors in that case?Cheers! :)

    Awesome! :)Thank you!I'm also a bit confused by this since as you say 200 should be the standard full step, but when playing around with the steps it seems 800 is correct.I think you might be correct about the mix up, I'm not certain that the code will count the steps, feels like there should be other data fed to it for it to work, but I'm not sure :PBut otherwise I think that should do it for the movement,How would you go about driving the Nemas if not by driver?Cheers!

    View Instructable »