Go Down

Topic: Digital write not working on DUE but same code works Uno and Mega 2560 (Read 765 times) previous topic - next topic


The following code works great on UNO and Mega 2560.  It is a driver for an Elechous dual channel motor driver.  I am using it to drive linear actuators with a joystick.  the condition loops work but digital write pins do go high when required.  see asterisks in code. Any help would be much appreciated

int SignalA= (0);//define input signal pin

int SignalB= (0);//define input signal pin

void setup()

  // default mode is INPUT


void LaIn()// Linear Actuator A IN
  digitalWrite(2, HIGH);   // in
  digitalWrite(5, HIGH);   // in
  analogWrite(3,1);   // in
void LaOut()// Linear Actuator A Out
  digitalWrite(2, HIGH);   // out
  digitalWrite(3, HIGH);   // out
  analogWrite(5,1);   // out   
void LaStop()// Linear Actuator A STOP
  digitalWrite(2, HIGH);   // stop  *********this pin goes high**********************
  digitalWrite(3, HIGH);   // stop  [font=Verdana]********************this pin and pin 5 do not ******************[/font]
  digitalWrite(5, HIGH);   // stop
void LbIn()// Linear Actuator B IN

  digitalWrite(8, HIGH);   // in
  digitalWrite(6, HIGH);   // in
  analogWrite(9,1);   // in
void LbOut()// Linear Actuator B Out
  digitalWrite(8, HIGH);   // in
  digitalWrite(9, HIGH);   // in
  analogWrite(6,1);   // in     
void LbStop()// Linear Actuator B STOP
  digitalWrite(8, HIGH);   // stop
  digitalWrite(9, HIGH);   // stop
  digitalWrite(6, HIGH);   // stop


void loop()  {

  digitalWrite(0, LOW); 
  digitalWrite(4, LOW);   //  set pin low
  digitalWrite(7, LOW);   //



  Serial.println(" ");

  if (SignalA > 900)

  if (SignalB > 900)

  if (SignalA < 400)

  if (SignalB < 400)

  if (SignalA > 400 && SignalA < 900)

  if (SignalB > 400 && SignalB < 900)


Go Up