Auto gate

But try to invert the motor control signal from the arduino, if HIGH is ON, turn it LOW for ON.

I dont know anything regarding your motor nor your controller, switching between digital and analog inputs is nothing ive seen possible on any motor controller ive seen.. :confused:

It COULD be that you need to have both directions in the same signal, like 0V=ON1, 2.5v=OFF, 5v= ON2, given that your input is 5v.

On a somewhat unrelated note, ive been having some SERIOUS issues debugging my codes, since i often fail to use the correct signal polarity (if high is on or off).

I solved that by defining a constant variable, bON and bOFF, witch are short for buttonON/OFF.
Since i use pull-up resistors, a pressed button is logical LOW, witch is the main reason for my confusion.
And therefore i declared in config: const int bON= LOW; const int bOFF= HIGH;

i can then use "if button1 == bON{ // enable whatever feature controlled by that specific button.};"

Im not saying that its the best way of dealing with such issues, but its a very simple way to work around the shortcomings of your (and my) brain.

This is a similar and simply setup of the parts with similar wiring

I dont know why single output relay card would require two input channels..

It might be that you must set one pin to low and the other to high, that you define each motor connector polarity by its corresponding input pin.

So if dpin9 is high, dpin 10 is low, the motor turns in left direction,
if dpin 9 is low, dpin 10 high, the motor turns in right direction,
if both pins low (or high), the motor is stopped.

the motor on the picture is a DC motor, so if you switch the red and black cables, the motor turns in the other direction.

So its possible that your two digital pins are simply to controll witch motor cable is ground and witch has current.

Still, just guessing here.. :slight_smile:

http://store.amequipment.com/206-series-gearhead-motor--12v-right-hand-p-195.html This is the motor I am using

Well, i read the manual for the syren driver card, and it turns out that you only need one analog wire.

as written in the manual:
Mode 1: Analog Input
Analog input mode takes one or two analog inputs an
d uses those to set the speed and direction
of the motor. The valid input range is 0v to 5v. Th
is makes the SyRen easy to control using a
potentiometer, the PWM output of a microcontroller
(with an R-C filter) or an analog circuit.
Major uses include joystick or foot-pedal controlle
d vehicles, speed and direction control for
pumps and machines and analog feedback loops. There
is also a Diff-Drive mixing mode which
takes two analog inputs for “tank style” steering.

The problem is that you cannot write a analog value to any pin on the arduino, the closest you get is duty-cycle.

You could use the mode2, pwm to control your motor, but that would require you to sort out the pulse width modulation, or use a library, in any way, a somewhat cumbersome route.

But i would use mode 3, serial.
Mode 3: Simplified serial.
Simplified serial mode uses TTL level RS-232 serial
data to set the speed and direction of the
motor. This is used to interface the SyRen to a PC
or microcontroller. If using a PC, a level
converter such as a MAX232 chip must be used. The b
aud rate is set via DIP switches.
Commands are single-byte, with 0 representing full
reverse and 255 representing full forward.
There is also a Slave Select mode which allows the
use of multiple motors from a single
microcontroller serial port.

Depending on wether youre using the USB port or not, you could connect the serial wire from the TX pin (1) to S1 on the relay board.

Remember that you have to connect ground as well as the serial wire in order to get serial working.. :slight_smile:

Have a look at pages 7 and 14 in the linked pdf.