This week I successfully constructed the wheels that attach to the motors and rubber banded them so that they will have traction on all surfaces. I centered the turning servo so that everything will be aligned when started. Next week I will assemble the axle and front wheels then I should be finished with my half of the project and will help Ran complete the shell.
We created our first iteration using cardboard, foam, and wooden dowels. We realized there would be a lot of design factors we hadn't originally thought of like what the eyes would look like, where the mouth would be, whether it should have a tongue or not, etc. We had trouble getting it to stand and support the cardboard cutouts. We hope to start the electronic components next week, but we will have to decide what the robot should be programmed to do (walk, make noises, recognize objects to not run into, etc). We also have to figure out what materials the final iteration should be made out of.
Today we binded the RC controller to the receiver and Aurino motorsheild. We learned about the RC controller and how to test the connection. We realized that we will only use two channels to control the driving of the sub, one for forwards backwards with the motor and one for right left with the servo. Above is the code examples that we used.
I completely finished all the driving components of the RC car. It drives forward, backward, turns left and right, and what will be the tail can wiggle back and forth. This is all controlled by the RC controlled and an Aurdino Motorshield. I am waiting for the sandwich shell to printed and then our project will be 100% finished.
#include <RCPulseIn.h>
#include <EnableInterrupt.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include <Servo.h>
Servo myservo1;
Servo myservo2;
int servo1;
int servo2;
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *motor1 = AFMS.getMotor(1);
Adafruit_DCMotor *motor2 = AFMS.getMotor(2);
defineRC(2);
defineRC(3);
defineRC(4);
void setup() {
Serial.begin(9600);
setupRC(2);
setupRC(3);
setupRC(4);
AFMS.begin();
myservo1.attach(8);
myservo2.attach(9);
}
void loop() {
Serial.print(readRC(2));
Serial.print(readRC(3));
Serial.print(readRC(4));
Serial.println();
int motor1Speed = deadbandMap(readRC(2),1000,200,2000,-255,0,255);
Serial.println(motor1Speed);
runMotor(motor1,motor1Speed);
runMotor(motor2,motor1Speed);
}
void runMotor(Adafruit_DCMotor *myMotor, int spd){
if(spd>0){
myMotor->run(FORWARD);
myMotor->setSpeed(spd);
}else if(spd<0){
myMotor->run(BACKWARD);
myMotor->setSpeed(-1*spd);
}else{
myMotor->run(BRAKE);
myMotor->setSpeed(0);
}
servo1 = deadbandMap(readRC(3),1000,200,2000,80,90,100);
servo2 = deadbandMap(readRC(4),1000,200,2000,80,90,100);
myservo1.write(servo1);
myservo2.write(servo2);
delay(15);
}