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 0:327a4132f8aa, committed 2018-10-29
- Comitter:
- aldomarez
- Date:
- Mon Oct 29 18:31:42 2018 +0000
- Commit message:
- a;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 327a4132f8aa main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Oct 29 18:31:42 2018 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+
+DigitalOut Led(D13);
+PwmOut Izq(D5);
+PwmOut Der(D6);
+InterruptIn Incrementa(USER_BUTTON);
+InterruptIn Decrementa(D15);
+
+float Estado;
+
+void dispara1() {
+ if(Estado>-1){
+ Estado=Estado-0.1;
+ }
+}
+void dispara2() {
+ if(Estado<1){
+ Estado=Estado+0.1;
+ }
+}
+
+int main(){
+ Estado=0.1;
+ Izq.period_us(1666);
+ Izq.write(Estado);
+ Der.period_us(1666);
+ Der.write(0);
+ Decrementa.fall(&dispara1);
+ Incrementa.fall(&dispara2);
+ Izq=1;
+ Der=0;
+ while(1){
+ Led=!Led;
+ if (Estado<0){
+ Izq.write(0);
+ Der.write(-Estado);
+ }
+ else{
+ Izq.write(Estado);
+ Der.write(0);
+ }
+ wait(0.5);
+ }
+}
+
diff -r 000000000000 -r 327a4132f8aa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 29 18:31:42 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file