David's dead reckoning code for the LVBots competition on March 6th. Uses the mbed LPC1768, DRV8835, QTR-3RC, and two DC motors with encoders.

Dependencies:   PololuEncoder Pacer mbed GeneralDebouncer

Committer:
DavidEGrayson
Date:
Tue Mar 04 00:46:18 2014 +0000
Revision:
29:cfcf08d8ac79
Parent:
28:4374035df5e0
Child:
31:739b91331f31
trying to figure out the analog problem;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DavidEGrayson 10:e4dd36148539 1 #include "line_sensors.h"
DavidEGrayson 10:e4dd36148539 2
DavidEGrayson 10:e4dd36148539 3 AnalogIn lineSensorsAnalog[LINE_SENSOR_COUNT] = {
DavidEGrayson 10:e4dd36148539 4 AnalogIn(p20), // brown wire, left-most sensor
DavidEGrayson 10:e4dd36148539 5 AnalogIn(p19), // orange wire, middle sensor
DavidEGrayson 28:4374035df5e0 6 AnalogIn(p17), // blue wire, right-most sensor
DavidEGrayson 29:cfcf08d8ac79 7 };
DavidEGrayson 29:cfcf08d8ac79 8
DavidEGrayson 29:cfcf08d8ac79 9 /**
DavidEGrayson 29:cfcf08d8ac79 10 uint16_t analogReadWithFilter(AnalogIn * input)
DavidEGrayson 29:cfcf08d8ac79 11 {
DavidEGrayson 29:cfcf08d8ac79 12 uint16_t readings[3];
DavidEGrayson 29:cfcf08d8ac79 13 for(uint8_t i = 0; i < 3; i++)
DavidEGrayson 29:cfcf08d8ac79 14 {
DavidEGrayson 29:cfcf08d8ac79 15 readings[i] = input->read_u16();
DavidEGrayson 29:cfcf08d8ac79 16 }
DavidEGrayson 29:cfcf08d8ac79 17
DavidEGrayson 29:cfcf08d8ac79 18 if (readings[0] <= readings[1] && readings[0] >= readings[2])
DavidEGrayson 29:cfcf08d8ac79 19 {
DavidEGrayson 29:cfcf08d8ac79 20 return readings[0];
DavidEGrayson 29:cfcf08d8ac79 21 }
DavidEGrayson 29:cfcf08d8ac79 22 if (readings[1] <= readings[0] && readings[1] >= readings[2])
DavidEGrayson 29:cfcf08d8ac79 23 {
DavidEGrayson 29:cfcf08d8ac79 24 return readings[1];
DavidEGrayson 29:cfcf08d8ac79 25 }
DavidEGrayson 29:cfcf08d8ac79 26 return readings[2];
DavidEGrayson 29:cfcf08d8ac79 27 }
DavidEGrayson 29:cfcf08d8ac79 28 **/