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.
Revision 11:5e955cf303ab, committed 2018-10-31
- Comitter:
- Nicolaemf
- Date:
- Wed Oct 31 14:21:58 2018 +0000
- Parent:
- 10:436c4728fa76
- Commit message:
- PWM on both sides;
Changed in this revision
Nico.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Nico.cpp Mon Oct 15 10:40:35 2018 +0000 +++ b/Nico.cpp Wed Oct 31 14:21:58 2018 +0000 @@ -1,3 +1,14 @@ -//this nico's file +#include "mbed.h" + +PwmOut led(LED1) -//i did some changes yeay \ No newline at end of file +int main(){ + while(1){ + led = led + 0.01; + wait(0.2); + if(led == 1.0){ + led = 0; + } + } + +}
--- 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); + + } + } +