Page 1 of 1

mdd10a DIR1 problem

PostPosted: Mon Oct 29, 2018 12:20 am
by alhmma
i have problem with my mdd10a rev 2.0 dir1 pin
when i press the cross button on my ps4 button it doesn't move the motor
i measure the voltage m1a it draw less then the others (m1b, m2a and m2b)
the motor work fine when manually tested and my ps4 controller

CODE: SELECT_ALL_CODE
#include <PS4BT.h>
#include <usbhub.h>
#ifdef dobogusinclude
#include <spi4teensy3.h>
#endif
#include <SPI.h>

USB Usb;

BTD Btd(&Usb);

PS4BT PS4(&Btd, PAIR);

#define dir_1 5
#define pwm_1 6
#define dir_2 8
#define pwm_2 9

void setup() {
  Serial.begin(115200);
  while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
  if (Usb.Init() == -1) {
    Serial.print(F("\r\nOSC did not start"));
    while (1); // Halt
    }
    Serial.print(F("\r\nPS4 Bluetooth Library Started"));

  pinMode(dir_1, OUTPUT);
  pinMode(pwm_1, OUTPUT);
  pinMode(dir_1, OUTPUT);
  pinMode(pwm_2, OUTPUT);

}

void loop() {
  Usb.Task();

  if(PS4.connected()){

    Serial.print(F("\nPS4 connected"));

    if(PS4.getButtonPress(CROSS)){

      analogWrite(pwm_1, 100);
      digitalWrite(dir_1, LOW);
     
    }
    if(PS4.getButtonPress(TRIANGLE)){

      analogWrite(pwm_1, 150);
      digitalWrite(dir_1, HIGH);
     
    }
    else {

      analogWrite(pwm_1, 0);
      analogWrite(pwm_2, 0);

    }
    if(PS4.getButtonPress(UP)){

      analogWrite(pwm_2, 150);
      digitalWrite(dir_2, HIGH);
     
    }
    if(PS4.getButtonPress(DOWN)){

      analogWrite(pwm_2, 150);
      digitalWrite(dir_2, LOW);
     
    }
    if (PS4.getButtonClick(PS)) {
      Serial.print(F("\r\nPS disconnected"));
      PS4.disconnect();
      Serial.end();
     
    }
  }
}

Re: mdd10a DIR1 problem

PostPosted: Wed Oct 31, 2018 6:54 am
by ober
Well, I do not check code :D because I am not compiler.

We need more information to identify where the problem is. It might be connection, it might code too. Can you show us the actual hardware connection in detailed? Capture a few clear photos and share here.