Week 5
This week is the final week, after several weeks of design and testing, our project has basically been completed. This
project is mainly based on Arduino and
Bluetooth technology and divided to two parts include glove part and car part. The flex sensors attached on the finger part of glove will
send signal to the Arduino
through Bluetooth in certain frequency, The car will have different reactions
to different orders upon receiving signals. The following are the results of the whole project:
The glove model which used to send signals (Figure 1):
Figure 1. Glove model
The car model which receive signals (Figure 2):
Figure 2. Car model
Different instructions on gloves can make car react differently. The corresponding table of car's reaction and glove instructions is shown in Figure 3.
Figure 3. The corresponding table of car's reaction and glove instructions
Demonstrate video 1
Demonstrate video 2
Motor Code:
#include"motor.h"
#include<SoftwareSerial.h>
motor start(10,9,8,7);//define 4 pins for motors
SoftwareSerial BTSerial(5, 6);//define the bluetooth pins :tdx and rdx
int state=1;//the states sit·1wuation
void setup()//set up the program
{
BTSerial.begin(9600);// Set Baud rate of bluetooth
Serial.begin(9600); // Ser Baud rate of serial
}
void loop()
{
start.Stop_Left() ;//the left side wheels stop
start.Stop_Right();//the right side wheels stop
if(BTSerial.available())//if the bluetooth is detected
{
state=BTSerial.read();//receive and read the signal from bluetooth
if(state=='1') //situation 1
{
Serial.println("Stop");//shows the car will stop
start.Stop_Left();//the left side wheels stop
start.Stop_Right();//the right side wheels stop
}
if(state=='2')//situation2
{
Serial.println("Go Forward");//shows the car will go forward
start.Forward_Left();//left side wheels go forward
start.Forward_Right();//the right side wheels go forward
delay(1000);//delay 2000 milliseconds
}
if(state=='3')//situation3
{
Serial.println("Go Reverse");//shows the car will go backward
start.Reverse_Left();//the left side wheels will go backward
start.Reverse_Right();//the right side wheels will go forward
delay(1000); //delay 2000 milliseconds
}
if(state=='4')//situation4
{
Serial.println("Forward_left");//shows the car will turn left and go forward
start.Forward_Left(); //the left side wheels go forward
start.Stop_Right();// the right side wheels stop
delay(1000);//delay 2000 milliseconds
}
if(state=='5')//situation5
{
Serial.println("Forward_right");//shows the car will turn right and go forward
start.Forward_Right(); //the right side wheels will go forward
start.Stop_Left();//the left side wheels will stop
delay(1000);//delay 3000 milliseconds
}
if(state=='6')//situation6
{
Serial.println("Reverse_left");//shows the car will turn left and go backward
start.Reverse_Left(); //the left side wheels will go backward
start.Stop_Right();//the right side wheels stop
delay(1000);//delay 2000 millisseconds
}
if(state=='7')//situation7
{
Serial.println("Reverse_right");//shows the car will turn right and go backward
start.Reverse_Right(); //the right side wheels will go backward
start.Stop_Left();//the left side wheels will stop
delay(1000);//delay 3000 milliseconds
}
if(state=='8')//situation8
{
Serial.println("anticlockwise");//shows the car will turns round anticlockwise
start.Reverse_Left();//shows the wheels will go backward
start.Forward_Right();//shows the wheels will go forward
delay(1000);//delay for 2000 milliseconds
}
if(state=='9')//situation9
{
Serial.println("clockwise");//the car will turn round clockwise
start.Forward_Left();//the left side wheels will go forward
start.Reverse_Right();//the right side wheels will go backward
delay(1000);//delay 2000 milliseconds
}
}
}
Flex Sensor Code:
评论
发表评论