Dmx signal to L293d motor shield

Hello everyone,

First of all I'm very new to arduino and everything coding but I thought of a project that I could maybe figure out by myself but I keep getting stuck.

What I'm trying to do is send a dmx signal from my lighting console to my dmx shield and with that signal I want to control a motor on my L293D motor shield, I've got a stepper motor connected to M3 an M4 but I can't figure out what to do to set a dmx channel to M3 and M4 on the motor shield.

After quite a while of research I came this code but it keeps spitting out an error that it can't convert AF_Stepper to uint8_t.

I'm hoping anyone can point me in the right direction.

Arduino uno R3
DMX Shield: ctc-dra-10-r2
Motorshield: L293D motor shield

#include <AFMotor.h>
// Connect a stepper motor with 400 steps per revolution
// to motor port #2 (M3 and M4)

AF_Stepper motor(400, 2);

#include <DMXSerial.h>

#define MAX_ANGLE 360
#define STEPS_FOR360 400

#include <DMXSerial_avr.h>
#include <DMXSerial_megaavr.h>

void setup() {
  DMXSerial.init(DMXReceiver);
  
  pinMode(motor, OUTPUT);
  

}

void loop() {

  analogWrite(motor, DMXSerial.read(1))

}

If You spit out the error code here, in the same, fine, way as You posted the code, helpers will a chance to drop a suggestion.

Have a look at the AFMotor library examples for how to setup and control the stepper motor.
analogWrite(motor, DMXSerial.read(1)) is not how you do it.

A single channel of DMX can only range 0-255 but there are 360 degrees in a full revolution so (assuming you want full circle) you will either need to map 0-255 to 0-359 or use two DMX channels.

You will probably need some sort of home position on the motor so it always starts where you expect when powered on and used under DMX control.

The AFMotor library does not seem to support absolute position (you program in a angle and it goes there) so you will need to track its current angle compared to the expected angle supplied by DMX and step it there.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.