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
main.cpp
- Committer:
- pridgejg
- Date:
- 2019-09-11
- Revision:
- 0:a4f7be3d6847
File content as of revision 0:a4f7be3d6847:
#include "mbed.h"
#include <iostream>
#include <math.h>
//Serial bt(PTE0,PTE1);// Bluetooth
PwmOut duty(PTA5);// pwm output
AnalogIn pot(PTB0); // potentiometer to adjust motor speed
DigitalOut myled(LED1);
int main() {
duty.period(0.00005);
// bt.baud(115200);// setting the baud rate
// bt.printf("We runnin' boys \n\r");
while(true) {
int loopCounter = 1;
while(loopCounter<20000){
float potPercent = pot.read(); // takes value from potentiometer
duty.write(potPercent);
loopCounter++;
}
cout << "\r\n TurnPot IN:" << (pot) << endl;
cout << "\r\n PWM OUT:" << (duty) << endl;
}
}