Introduction: Getsure Control Robot Car
Gesture recognition robot car based on Micrcohip MGC3130 Efield Technology.
Step 1: Materials Required
Step 2: Arduino Connection to Motor and Zigbee
Note: Driver Connection has not shown you have to include any motor drivers like uln2003.
Step 3: Connection of Gesture Recognition Kit to the Zigbee
Step 4: Arduino Source Code for Gesture Based Robot Car
#define BAUDRATE 9600
const int MotR_A = 3; // DC Motor1 Pole_A
const int MotR_B = 5; // DC Motor1 Pole_B
const int MotL_A = 6; // DC Motor2 Pole_A
const int MotL_B = 9; // DC Motor2 Pole_B
byte GetValue;
void setup()
{
Serial.begin(BAUDRATE);
pinMode(MotR_A, OUTPUT);
pinMode(MotR_B, OUTPUT);
pinMode(MotL_A, OUTPUT);
pinMode(MotL_B, OUTPUT);
}
byte ReadOneByte() // One Byte Read Function
{
int ByteRead;
while(!Serial.available());
ByteRead = Serial.read();
return ByteRead;
}
void loop()
{
GetValue = ReadOneByte();
switch(GetValue)
{
case 'C':
Robot_Left();
break;
case 'A':
Robot_Right();
break;
case 'N':
Robot_Forword();
break;
case 'S':
Robot_Reverse();
break;
case 'E':
Robot_Left();
delay(1000);
Robot_Forword();
break;
case 'W':
Robot_Right();
delay(1000);
Robot_Forword();
break;
}
}
void Robot_Reverse()
{
digitalWrite(MotR_B, HIGH);
digitalWrite(MotR_A, LOW);
digitalWrite(MotL_A, HIGH);
digitalWrite(MotL_B, LOW);
}
void Robot_Forword()
{
digitalWrite(MotR_A, HIGH);
digitalWrite(MotR_B, LOW);
digitalWrite(MotL_B, HIGH);
digitalWrite(MotL_A, LOW);
}
void Robot_Left()
{
digitalWrite(MotR_B, HIGH);
digitalWrite(MotR_A, LOW);
digitalWrite(MotL_A, LOW);
digitalWrite(MotL_B, HIGH);
}
void Robot_Right()
{
digitalWrite(MotR_B, LOW);
digitalWrite(MotR_A, HIGH);
digitalWrite(MotL_A, HIGH);
digitalWrite(MotL_B, LOW);
}
void Robot_Stop()
{
digitalWrite(MotR_B, LOW);
digitalWrite(MotR_A, LOW);
digitalWrite(MotL_A, LOW);
digitalWrite(MotL_B, LOW);
}