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: PololuEncoder Pacer mbed GeneralDebouncer
main.cpp
- Committer:
- DavidEGrayson
- Date:
- 2014-02-22
- Revision:
- 8:78b1ff957cba
- Parent:
- 7:85b8b5acfb22
- Child:
- 9:9734347b5756
File content as of revision 8:78b1ff957cba:
#include <mbed.h>
#include <Pacer.h>
#include "motors.h"
#include "encoders.h"
#include "pc_serial.h"
#include "leds.h"
int main()
{
pc.baud(115200);
// Enable pull-ups on encoder pins and give them a chance to settle.
encoders_init();
motors_init();
// Test routines
motors_test();
encoders_test();
Pacer reportPacer(500000);
Pacer blinkPacer(200000);
while(1)
{
while(encoderBuffer.hasEvents())
{
PololuEncoderEvent event = encoderBuffer.readEvent();
}
if(reportPacer.pace())
{
led2 = 1;
pc.printf("%8d %8d\n", encoder1.getCount(), encoder2.getCount());
led2 = 0;
}
if (blinkPacer.pace())
{
led1 = !led1;
}
}
}