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: xtoff2 RF24Network mbed
Fork of xtoff3 by
Revision 8:c43411433ce1, committed 2018-02-22
- Comitter:
- pietor
- Date:
- Thu Feb 22 14:08:11 2018 +0000
- Parent:
- 7:8515f205483b
- Child:
- 9:e14f65b8ffc2
- Commit message:
- Werken 22.02;
Changed in this revision
| Ontvanger.h | 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/Ontvanger.h Wed Feb 21 12:05:17 2018 +0000
+++ b/Ontvanger.h Thu Feb 22 14:08:11 2018 +0000
@@ -13,12 +13,23 @@
const uint16_t this_node = 00;
const uint16_t other_node = 01;
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+
struct payload_t {
bool reedsensor;
- int milligram;
+ float milligram;
};
+enum State2 {init_state,
+ send_state,
+ receive_state
+ };
+
enum State {State_init,
State_tare,
State_position,
--- a/main.cpp Wed Feb 21 12:05:17 2018 +0000
+++ b/main.cpp Thu Feb 22 14:08:11 2018 +0000
@@ -7,21 +7,10 @@
#include "mbed.h"
#include "Ontvanger.h"
-DigitalOut myled1(LED1);
-DigitalOut myled2(LED2);
-DigitalOut myled3(LED3);
-DigitalOut myled4(LED4);
-
Serial pc(USBTX, USBRX);
-
Ontvanger receive;
-
Timer t;
-enum State2 {init_state,
- send_state,
- receive_state
- };
State2 current_state = init_state;
@@ -72,7 +61,7 @@
if (receive.available()) {
payload_t payload;
payload = receive.read();
- pc.printf("massa = %d\r\n",payload.milligram);
+ pc.printf("%f\r\n", payload.milligram);
if (payload.reedsensor) {
acitvateLed();
}
@@ -90,7 +79,6 @@
wait(0.5);
}
break;
-
}
}
}
\ No newline at end of file
