Esempio per carlo
Revision 0:d388a00e3820, committed 2018-01-25
- Comitter:
- fdalforno
- Date:
- Thu Jan 25 10:30:24 2018 +0000
- Child:
- 1:2ca9dd78e30c
- Commit message:
- Esempio Per carlo
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jan 25 10:30:24 2018 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include <stdlib.h>
+
+
+InterruptIn encoder(USER_BUTTON); //FACCIO FINTA CHE L'encoder sia il bottone attento ne servono due uno per ruota
+
+long int count1;
+int scattiPerGiro = 3;
+
+void ruota1() {
+ count1++;
+}
+
+
+float numeroGiri(){
+ return count1 / scattiPerGiro;
+}
+
+
+
+
+
+int main()
+{
+ encoder.rise(&ruota1);
+
+ while (1) {
+ led = !led;
+ wait(delay);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jan 25 10:30:24 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file