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: MODSERIAL QEI mbed mbed-dsp
Fork of Minor_test_serial by
main.cpp
- Committer:
- SimonRez
- Date:
- 2018-09-25
- Revision:
- 7:e21056555296
- Parent:
- 6:1ee8795b7578
- Child:
- 8:9b517db94f49
File content as of revision 7:e21056555296:
#include "mbed.h"
#include "MODSERIAL.h"
#include "QEI.h"
DigitalOut ledr(LED_RED);
DigitalOut ledg(LED_GREEN);
DigitalOut ledb(LED_BLUE);
PwmOut pwmpin(PTA2);
DigitalOut direct(PTB23);
AnalogIn pot1(A0);
QEI encoder(D12,D13,NC,32);
InterruptIn sw2(SW2);
InterruptIn sw3(SW3);
MODSERIAL pc(USBTX, USBRX);
int main()
{
ledr = 1;
ledg = 1;
ledb = 1;
pc.printf("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n ~~~A$$De$troyer69~~~ \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n");
pwmpin.period_us(60);
pwmpin = 0;
while (true)
{
pwmpin.write(pot1.read());
direct = 1;
pc.printf("potmeter: %f, encoder: %i \r\n", pot1.read(), encoder.getPulses());
wait(0.2f);
}
}
