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.
Diff: main.cpp
- Revision:
- 11:5e955cf303ab
- Parent:
- 6:b476699ac7d4
--- a/main.cpp Mon Oct 15 10:40:35 2018 +0000 +++ b/main.cpp Wed Oct 31 14:21:58 2018 +0000 @@ -1,17 +1,36 @@ #include "mbed.h" -//hello guys, this is a test + +Serial pc(USBTX, USBRX); // tx, rx -//merge conflict for the win +PwmOut myled(LED1); +PwmOut motorRight(PTD0); +PwmOut motorLeft(PTD5); -DigitalOut myled(LED1); +//PwmOut pwm1(PTD0); +AnalogIn potInput(PTB0); +float storeInput; + -// This is the main() function -// hello int main() { + + myled = 0.1; + while(1) { - myled = 1; - wait(10); - myled = 0; - wait(100); - } + + myled = myled + 0.1; + + if(myled >= 1){ + myled = 0; + } + storeInput = potInput.read(); + motorRight = storeInput; + motorLeft = (storeInput * -1.0) + 1.0; + + pc.printf("%f\n", storeInput); + + wait(0.1); + + } + } +