Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed-src pixylib
global.cpp
- Committer:
- balsamfir
- Date:
- 2016-03-25
- Revision:
- 9:62fbb69b612c
- Parent:
- 7:5ef312aa2678
- Child:
- 15:caa5a93a31d7
File content as of revision 9:62fbb69b612c:
#include "global.h"
// IO Port
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
DigitalOut leftDir(p24); //
DigitalOut rightDir(p22); //
DigitalOut spiReset(p8); //changed
DigitalOut ioReset(p14); //
// Comunication
SPI deSpi(p5, p6, p7);
Pixy pixy(Pixy::SPI, p11, p12, p13);
//Serial pc(USBTX, USBRX); // PC serial channel
Serial pc(p28, p27); // Bluetooth serial channel
// Control
PeriodicPI leftMotorPI(MOTOR_PERIOD, MOTOR_KP, MOTOR_KI);
PeriodicPI rightMotorPI(MOTOR_PERIOD, MOTOR_KP, MOTOR_KI);
PeriodicPI heightPI(NAVIGATION_PERIOD, SPEED_KP, SPEED_KI);
PeriodicPI xPI(NAVIGATION_PERIOD, STEERING_KP, STEERING_KI);
// Other
PwmOut leftPwm(p23); //
PwmOut rightPwm(p21); //
InterruptIn bumper(p25);
// Converts measurements from the QE2 to rads/sec
float QE2RadsPerSec(short counts, short time) {
return ((float)counts*122.62)/time;
}
