ArduinoGeneral

Motor control using HC-05 and Matlab

userHead Hee BaoKang 2016-02-01 10:13:34 3344 Views4 Replies
Hi, I am trying to control the motors of my robot using Matlab and HC-05.
It is a 3 wheeled omni robot on Arduino Leonardo Board. Romeo V2.
The robot wheel is suppose to move when I send '1' or stop when '0'.
Below is the Arduino Code:
Code: Select all
//Standard PWM DC control
int E1 = 5; //M1 Speed Control
int E2 = 6; //M2 Speed Control
int E3 = 11; //M3 Speed Control
int M1 = 4; //M1 Direction Control
int M2 = 7; //M2 Direction Control
int M3 = 9; //M3 Direction Control
int val = 0;
void setup(void)
{
Serial1.begin(9600);
}
void loop()
{
if(Serial1.available() > 0){
val = Serial1.read();
switch(val)
{
if (val==1)
{
analogWrite(E1,HIGH);
}
if (val==0)
{
analogWrite(E1,LOW);
}
}
}
}


And below is my Matlab code:
Code: Select all
b = Bluetooth ('HC-05',1);
fopen(b);
fwrite(b,1);


However, there is no response at all. Where might be the problem?
2016-02-06 01:13:00 Hi Maht,
Thanks. Hope to receive your tech support's reply soon!
userHeadPic Hee BaoKang
2016-02-03 23:09:44 Thanks for the info. This issue has been passed on to tech support userHeadPic Maht
2016-02-02 06:50:12 Hi Maht,
Thank for your reply. I am using 3 x 16009 Nexus, 12V DC motor.

Besides the Romeo V2 board, I also have got a Romeo BLE which could be also be use if it might provide a easier method.
userHeadPic Hee BaoKang
2016-02-01 21:39:28 Hi there, welcome to the forum. sorry you have issues.
Our tech support team is looking in to this issue. What kind of motors are you using for this?
userHeadPic Maht