Creativity is allowing yourself to make mistakes.
Design is knowing which one to stay put with.
It’s all about making it happen for you.
Task
Exhibit the Group efforts in building the machine ideated in the
Mechanical Design Assignment.
Group Assignment Our Machine – Cablebot
Manoj Sahukar, Tushar Kukreja, Jaydip Sarode, Anand
Verma, Hemang Vellore, Pooja Jadhav and Aaditi Kharade.
#include
#define X_Axis A0
#define Y_Axis A1
#define Switch A3
SoftwareSerial Bluetooth(2,3); // pin2- connected to bluetooth Tx
// pin3- connected to bluetooth Rx
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Bluetooth.begin(9600);
pinMode(A3,INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
int x_axis, y_axis;
x_axis = analogRead(X_Axis);
y_axis = analogRead(Y_Axis);
if(x_axis > 750){
Serial.print("R");
delay(2000);
}
else if(x_axis < 250){
Serial.print("R");
delay(2000);
}
if(y_axis > 750){
Serial.print("F");
delay(100);
}
else if(y_axis < 250){
Serial.print("B");
delay(100);
}
if(x_axis < 600 && x_axis > 450 && y_axis <
600 && y_axis > 450){
Serial.print("S");
delay(100);
}
}
Code – For operating the Cable Bot with Bluetooth
#include
#define M_L1 4
#define M_L2 5
#define M_R1 6
#define M_R2 7
char cmd = 0;
SoftwareSerial Bluetooth(2, 3); // pin2- connected to bluetooth Tx
// pin3- connected to bluetooth Rx
void setup() /****** SETUP: RUNS ONCE ******/
{
Serial.begin(9600);
Bluetooth.begin(9600);
pinMode(M_L1, OUTPUT);
pinMode(M_L2, OUTPUT);
pinMode(M_R1, OUTPUT);
pinMode(M_R2, OUTPUT);
digitalWrite(M_R1, LOW);
digitalWrite(M_R2, LOW);
digitalWrite(M_L1, LOW);
digitalWrite(M_L2, LOW);
}
void loop()
{
if (Bluetooth.available() > 0)
{
cmd = Bluetooth.read();
if(cmd == 'F'){
Forward();
}
else if(cmd == 'B'){
Back();
}
else if(cmd == 'L'){
Left();
}
else if(cmd == 'R'){
Right();
}
else if(cmd == 'S'){
Stop();
}
}
}
void Forward() {
digitalWrite(M_R1, LOW);
digitalWrite(M_R2, HIGH);
digitalWrite(M_L1, LOW);
digitalWrite(M_L2, HIGH);
delay(100);
}
void Back() {
digitalWrite(M_R1, HIGH);
digitalWrite(M_R2, LOW);
digitalWrite(M_L1, HIGH);
digitalWrite(M_L2, LOW);
delay(100);
}
void Left() {
digitalWrite(M_R1, LOW);
digitalWrite(M_R2, HIGH);
digitalWrite(M_L1, LOW);
digitalWrite(M_L2, LOW);
delay(1000);
Stop();
}
void Right() {
digitalWrite(M_R1, LOW);
digitalWrite(M_R2, LOW);
digitalWrite(M_L1, LOW);
digitalWrite(M_L2, HIGH);
delay(1000);
Stop();
}
void Stop() {
digitalWrite(M_R1, LOW);
digitalWrite(M_R2, LOW);
digitalWrite(M_L1, LOW);
digitalWrite(M_L2, LOW);
}
//--(end main loop )---