Aballen and Mem thanks help for the code, but no such luck.
Not sure if serial out is not working right or if it's the motor driver command set not being sent just right
(the mortar drive is working when I use my BS2)..
I have decided that using the TX pin 1 is fine for now, so when I load the code and open the Serial monitor to see what's being sent out on pin 1, ever 5 seconds I get: 12801100
START CODE
#include <SoftwareSerial.h>
byte potPin = 0;
//serial setup (Note: not using rxPin but the include file requiers it be set)
byte rxPin = 0;
byte txPin = 1;
int motor_reset = 8; // Motor reset pin
void setup() {
pinMode(motor_reset, OUTPUT); // sets the reset pin as output
pinMode(txPin, OUTPUT); // sets the TX pin as output
mySerial.begin(9600);
}
void loop() {
digitalWrite(motor_reset, LOW); // reset motor controller
digitalWrite(motor_reset, HIGH);
delay(100); // reset delay
{
mySerial.print(0x80); //Start byte
mySerial.print(0x00); //Device type byte
mySerial.print(0x01); //Motor number and direction byte
mySerial.print(0x64); // Motor speed "0 to 128" (100 is 64 in hex)
delay(5000); // Wait 5 sec then resend data
}
}
END CODE
-References-
The image details the byte setup to be sent.
(The motor drive PDF)
Page 8 has the byte setup.
I'm excited to get off the BS2 bandwagen, nothing beats the price and open source of the arduino, woohoo! [smiley=cool.gif]
Thanks
Shane
yes you are correct, I would actually recommend not using 1 and 2... I like to keep those for debugging....
my sample was really just a cut and paste... intended to show how to use the serial... not to use the actual code... I'll have to be clearer next time... sorry
//for serial port on USB
byte rxPin = 0;
byte txPin = 1;
Aballen, I think meant byte txPin = 3; as per the OP's desire for output on pin 3
I actually got my hands on one of these, and I cant even get it to initialize, even when i send the config data I get nothing....I could just switch to a regular h-bridge, but I want to get this working.
// Spin Forwords
buff[0]=0x80;//start byte
buff[1]=0x00;//Device type byte
buff[2]=0x00;//Motor number and direction byte
buff[3]=0x14;// Motor speed "0 to 128" (100 is 64 in hex)
for(int i=0;i<4;i++){
Serial.print(buff*,BYTE);*
}* delay(5000); // Wait 5 sec then resend data // Spin Backwords digitalWrite(motor_reset, LOW); // reset motor controller delay(10); digitalWrite(motor_reset, HIGH); delay(100); // reset delay
buff[0]=0x80;//start byte*
buff[1]=0x00;//Device type byte*
buff[2]=0x01;//Motor number and direction byte (0 or 1 .. or change to 2 or 3 for first set of motor pins)*
buff[3]=0x14;// Motor speed "0 to 128" (100 is 64 in hex)*
for(int i=0;i<4;i++){*
_ Serial.print(buff*,BYTE);_
_ }_ delay(5000); // Wait 5 sec then resend data
_}_
_### END CODE ###*_ Give that a shot... Let me know how it works out for you. Shane
ok my code works, in fact it seems to fire up the motors, and then two seconds later it stops....
What are you hooking up the vcc pin on the controller to? Which controller are you using?
I'm using the low-voltage dual serial motor controller, they(at pololu) say arduino may not be able to supply enough power at 5v to power the controller.... which is a bit frustrating to say the least.....
Well im using some rather small motors (the Solarbotics GM9 Pololu - Solarbotics GM9 143:1 Gear Motor 90 deg. Output ) and it drives them fine off the USB port but i do plan to power them from a battery pack when i finaly place the Arduino on the lil robot, im thinking 4 AA batteries will do for what i need.. you can give the motors more power up to 9V via that controller.
The image below shows using a battery.
how big are your motors? dose the motor drive get hot or does the power light on the Arduino go out?
Only with the software serial library, it bit bangs the data out. It will not run as fast as the inbuilt hardware serial and sending is much better than receiving. However I am not sure what the SCI is.
Note that the output pins are TTL voltage levels, if you want to connect to RS232 you have to use a converter chip.
sci is serial com interface < reading books since i cant program or jump into it .. its meaningless ..
if you have any codes on how to turn the pins to serial pins and send data through them please add it.
i ve tried to load the software serial on the mega and it didnt work and on the deminilova and didnt work as well the the mega was easier to send data serialy out from using serial1.print < to use pin tx 1 and so on .
thank you kindly please post the codes again if u have them or a link to a tutorial on how to use software serial
i couldnt get the serial lcd working on it, but it worked ok with the mega maybe i used the tx pin wrong or the code was wrong .. serial1.print worked ok with the mega is it something else for the deminluova ?