GT ECE 4180 Lab Team - Raj Madisetti and Arjun Sonti

Dependencies:   mbed Servo Motordriver X_NUCLEO_53L0A1 HC_SR04_Ultrasonic_Library

Remote Control Car

Georgia Tech ECE 4180 Embedded Systems Design Final Project

Team Members

Raj Madisetti Arjun Sonti

Committer:
rmadisetti3
Date:
Sun Nov 15 22:18:34 2020 +0000
Revision:
0:20a8dfc396cb
Child:
1:1c1ad0c1c260
initial commit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rmadisetti3 0:20a8dfc396cb 1 #include "mbed.h"
rmadisetti3 0:20a8dfc396cb 2 #include "XNucleo53L0A1.h"
rmadisetti3 0:20a8dfc396cb 3 #include "Servo.h"
rmadisetti3 0:20a8dfc396cb 4 #include "motordriver.h"
rmadisetti3 0:20a8dfc396cb 5 #include <stdio.h>
rmadisetti3 0:20a8dfc396cb 6 //Serial pc(USBTX,USBRX);
rmadisetti3 0:20a8dfc396cb 7 //DigitalOut shdn(p26);
rmadisetti3 0:20a8dfc396cb 8 DigitalOut myled(LED1);
rmadisetti3 0:20a8dfc396cb 9
rmadisetti3 0:20a8dfc396cb 10 //#define VL53L0_I2C_SDA p28
rmadisetti3 0:20a8dfc396cb 11 //#define VL53L0_I2C_SCL p27
rmadisetti3 0:20a8dfc396cb 12
rmadisetti3 0:20a8dfc396cb 13 //static XNucleo53L0A1 *board=NULL;
rmadisetti3 0:20a8dfc396cb 14 Motor M(p21, p22, p23, 1); // pwm, fwd, rev, can brake
rmadisetti3 0:20a8dfc396cb 15 Servo myservo(p24);
rmadisetti3 0:20a8dfc396cb 16
rmadisetti3 0:20a8dfc396cb 17
rmadisetti3 0:20a8dfc396cb 18 int main() {
rmadisetti3 0:20a8dfc396cb 19 // int status;
rmadisetti3 0:20a8dfc396cb 20 // uint32_t distance;
rmadisetti3 0:20a8dfc396cb 21 // DevI2C *device_i2c = new DevI2C(VL53L0_I2C_SDA, VL53L0_I2C_SCL);
rmadisetti3 0:20a8dfc396cb 22 // /* creates the 53L0A1 expansion board singleton obj */
rmadisetti3 0:20a8dfc396cb 23 // board = XNucleo53L0A1::instance(device_i2c, A2, D8, D2);
rmadisetti3 0:20a8dfc396cb 24 // shdn = 0; //must reset sensor for an mbed reset to work
rmadisetti3 0:20a8dfc396cb 25 // wait(0.1);
rmadisetti3 0:20a8dfc396cb 26 // shdn = 1;
rmadisetti3 0:20a8dfc396cb 27 // wait(0.1);
rmadisetti3 0:20a8dfc396cb 28 // /* init the 53L0A1 board with default values */
rmadisetti3 0:20a8dfc396cb 29 // status = board->init_board();
rmadisetti3 0:20a8dfc396cb 30 // while (status) {
rmadisetti3 0:20a8dfc396cb 31 // pc.printf("Failed to init board! \r\n");
rmadisetti3 0:20a8dfc396cb 32 // status = board->init_board();
rmadisetti3 0:20a8dfc396cb 33 // }
rmadisetti3 0:20a8dfc396cb 34 // //loop taking and printing distance
rmadisetti3 0:20a8dfc396cb 35 // while (1) {
rmadisetti3 0:20a8dfc396cb 36 // status = board->sensor_centre->get_distance(&distance);
rmadisetti3 0:20a8dfc396cb 37 // if (status == VL53L0X_ERROR_NONE) {
rmadisetti3 0:20a8dfc396cb 38 // pc.printf("D=%ld mm\r\n", distance);
rmadisetti3 0:20a8dfc396cb 39 // }
rmadisetti3 0:20a8dfc396cb 40 // }
rmadisetti3 0:20a8dfc396cb 41 for (float s= -1.0; s < 1.0 ; s += 0.01) {
rmadisetti3 0:20a8dfc396cb 42 M.speed(s);
rmadisetti3 0:20a8dfc396cb 43 wait(0.02);
rmadisetti3 0:20a8dfc396cb 44 }
rmadisetti3 0:20a8dfc396cb 45
rmadisetti3 0:20a8dfc396cb 46 for(float p=0; p<1.0; p += 0.1) {
rmadisetti3 0:20a8dfc396cb 47 myservo = p;
rmadisetti3 0:20a8dfc396cb 48 wait(0.2);
rmadisetti3 0:20a8dfc396cb 49 }
rmadisetti3 0:20a8dfc396cb 50 }