Code eksemple for SmartMotorDriveDuo60 to car

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Code eksemple for SmartMotorDriveDuo60 to car

Postby sun » Sun Jan 22, 2017 10:55 pm

Bought 2 pieces. Smart Motor Drive Duo60
Want to make a car.
The following function desired.
In the run to the right, the left wheels run more slowly than the right wheel.
In the run to the left wheels run faster than the right wheel.
At run straight on both wheels run the same speed.
The same goes straight backwards.

Will use Receiver:
http://www.banggood.com/Wholesale-FS-R6 ... 68604.html

Is there some here that will help with some code for the Arduino Board Mega2560 R3.
Do have absolutely no experience with C ++
But I can do some code in FlowCode but not enough to get my car to,
running from Turnigy 9XR PRO Radio Transmitter.
Turnigy 9XR PRO is code for car management !

Basic code
CODE: SELECT_ALL_CODE
/*    PWM input mode with microcontroller (Independent Both), DIP switch 1 0 1 1 0 1 1 0
         User: Arduino Board Mega2560 R3
                    With PWM out to left and right.
                    SmartDriveDuo60 - MDDS60
                   Run with RC Mode with RC Transmitter/Receiver, DIP Switch
    */   
    #include<math.h>

    int dig1=A2;  //pin signal for motor left
    int dig2=A3;  //pin signal for motor right
    int an1= D2;  //pin pwm for motor left
    int an2= D3;  //pin pwm for motor right

   void setup()
    {     
      delay(100);
      pinMode(dig1,OUTPUT);      //initialize for all the input and output
      pinMode(dig2,OUTPUT);
      pinMode(an1,INPUT);
      pinMode(an2,INPUT);
      Serial.begin(9600);
      analogWrite(an1,0);  //Based on the datasheet,
                                         the MDDS60 analog pin should get 0 input upon start
      analogWrite(an2,0);  //thus we need to send 0 value at the beginning delay(1000);                       
     
    }


Yours sincerely
Monie Jacobsen
Yours sincerely
Monie
sun
Freshie
 
Posts: 4
Joined: Tue Jan 17, 2017 2:45 pm

Re: Code eksemple for SmartMotorDriveDuo60 to car

Postby Idris » Mon Jan 23, 2017 2:12 pm

Hi run,

If you're planning to use MDDS60 with RC remote control, you don't need any extra controller. Just plug and play. You can refer to MDDS60 Quick Start Guide for connection.

Thanks.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: Code eksemple for SmartMotorDriveDuo60 to car

Postby sun » Mon Jan 23, 2017 4:05 pm

Hi Idris
I want to run a microcontroller.
Want to learn Ardino C ++
Therefore, it would be nice if I had some basic code that can run.
And even can add multiple C ++ code to the device.
Yours sincerely
Monie
sun
Freshie
 
Posts: 4
Joined: Tue Jan 17, 2017 2:45 pm

Re: Code eksemple for SmartMotorDriveDuo60 to car

Postby Idris » Tue Jan 24, 2017 3:05 pm

Hi run,

I'm assuming the connection between Arduino and MDDS60 is for PWM with Microcontroller: Independent Both (2nd photo in MDDS60 Quick Start Guide).

You can try the following code:
CODE: SELECT_ALL_CODE
int DIG1 = 7; // Arduino pin 7 is connected to MDDS60 pin DIG1.
int DIG2 = 4; // Arduino pin 4 is connected to MDDS60 pin DIG2.
int AN1 = 6; // Arduino pin 6 is connected to MDDS60 pin AN1.
int AN2 = 5; // Arduino pin 5 is connected to MDDS60 pin AN2.

void setup()
{
  pinMode(DIG1, OUTPUT); // Set Arduino pin 7 (DIG1) as output.
  pinMode(DIG2, OUTPUT); // Set Arduino pin 4 (DIG2) as output.
  pinMode(AN1, OUTPUT); // Set Arduino pin 6 (AN1) as output.
  pinMode(AN2, OUTPUT); // Set Arduino pin 5 (AN2) as output.

  delay(5000); // Delay for 5 seconds.
}

void loop()
{
  // Controlling motor 1.
  analogWrite(AN1, 100); // Set motor 1 speed less than half. Max is 255.
  digitalWrite(DIG1, LOW); // Motor 1 start moving for 2s.
  delay(2000);
  digitalWrite(DIG1, HIGH); // Motor 1 move to another direction for 2s.
  delay(2000);
  analogWrite(AN1, 0); // Stop motor 1.

  delay(1000); // Delay for 1s

  // Controlling motor 2.
  analogWrite(AN2, 100); // Set motor 2 speed less than half. Max is 255.
  digitalWrite(DIG2, LOW); // Motor 1 start moving for 2s.
  delay(2000);
  digitalWrite(DIG2, HIGH); // Motor 1 move to another direction for 2s.
  delay(2000);
  analogWrite(AN2, 0); // Stop motor 2.

  delay(1000); // Delay for 1s
}

Thanks.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: Code eksemple for SmartMotorDriveDuo60 to car

Postby sun » Tue Jan 24, 2017 5:01 pm

HI Idris

Many, many thanks Idris..
Now I have something basic that works and that I can build on codes;-)
Yours sincerely
Monie
sun
Freshie
 
Posts: 4
Joined: Tue Jan 17, 2017 2:45 pm

Re: Code eksemple for SmartMotorDriveDuo60 to car

Postby Idris » Wed Jan 25, 2017 5:20 pm

Hi sun, glad to hear that.

You also can refer to Let’s Arduino Control Your SmartDriveDuo-60 tutorial for other method.

Thanks.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: Code eksemple for SmartMotorDriveDuo60 to car

Postby sun » Sat Jun 17, 2017 10:25 pm

LawnMower Wheel steering!
I bought SmartDriveDuo60 MDDS60
And want to use FlowCode coder to control MDDS60.
MDDS60UsersManual:
http://www.robotshop.com/media/files/pd ... Manual.pdf
Please see here!
Page No: 2
Page No: 20

There are different Input Mothes
Analog/PWM Input Mode - Page No: 18
Simplified Serial Mode - Page No: 21
Packetized Serial Mode - Page No: 23

Is there anyone here that will help me get an output to MDDS60 from
FlowCode, which is attached here!
MIACdsPIC-LawnMower-022.zip
(4.31 KiB) Downloaded 243 times

Code image:
Turn Rigth And Left.JPG
Yours sincerely
Monie
sun
Freshie
 
Posts: 4
Joined: Tue Jan 17, 2017 2:45 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 18 guests

cron