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 11:77018fac195e, committed 2018-03-09
- Comitter:
- pietor
- Date:
- Fri Mar 09 12:22:27 2018 +0000
- Parent:
- 10:0a4c465f7838
- Child:
- 12:a3dd2ebf8f93
- Commit message:
- 9/03 test
Changed in this revision
--- a/Ontvanger.cpp Fri Mar 09 08:26:00 2018 +0000
+++ b/Ontvanger.cpp Fri Mar 09 12:22:27 2018 +0000
@@ -37,6 +37,7 @@
RF24NetworkHeader header_tx(other_node);
state_Packet packet;
packet = message;
+
return network.write(header_tx,&packet,sizeof(packet));
}
--- a/Ontvanger.h Fri Mar 09 08:26:00 2018 +0000
+++ b/Ontvanger.h Fri Mar 09 12:22:27 2018 +0000
@@ -10,13 +10,19 @@
#define spi_MOSI p5
#define spi_MISO p6
+#ifdef PRINT_ENABLE
+ #define IF_PRINT_ENABLE(x) ({x;})
+ #else
+ #define IF_PRINT_ENABLE(x)
+ #endif
+
+
+//Identification verzender/ontvanger
const uint16_t this_node = 00;
const uint16_t other_node = 01;
-
-
-
+//
struct payload_t {
bool reedsensor;
float milligram;
--- a/RF24.lib Fri Mar 09 08:26:00 2018 +0000 +++ b/RF24.lib Fri Mar 09 12:22:27 2018 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/akashvibhute/code/RF24/#e94be00fd19e +http://developer.mbed.org/users/akashvibhute/code/RF24/#f79c43f3b5b9
--- a/RF24Network.lib Fri Mar 09 08:26:00 2018 +0000 +++ b/RF24Network.lib Fri Mar 09 12:22:27 2018 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/akashvibhute/code/RF24Network/#dfc8da7ac18c +http://developer.mbed.org/users/akashvibhute/code/RF24Network/#80195a45b25c
--- a/main.cpp Fri Mar 09 08:26:00 2018 +0000
+++ b/main.cpp Fri Mar 09 12:22:27 2018 +0000
@@ -3,7 +3,27 @@
Purpose: main class
@author Pieter Berteloot
+
+ RF24 PINOUT:
+ ---- -----
+ |GND | VCC |
+ |---- |
+ |CE CSN |
+ |SCK MOSI|
+ |MISO IRQ |
+ ---- -----
+
+ ---- -----
+ |GND | Vout|
+ |---- |
+ |p9 p8 |
+ |p7 p5 |
+ |p6 NC |
+ ---- -----
*/
+//uncommend #define PRINT_ENABLE to see informational prints
+//#define PRINT_ENABLE
+
#include "mbed.h"
#include "Ontvanger.h"
@@ -36,10 +56,9 @@
int main()
{
- pc.printf("\r\nOntvanger: \r\n");
- pc.printf("testing Radio... %d", receive.isValid());
- pc.printf("testing Carrier... %d", receive.testRPD());
-
+ IF_PRINT_ENABLE( pc.printf("\r\nOntvanger: \r\n");
+ pc.printf("testing Radio... %d\r\n", receive.isValid());
+ );
while(1) {
receive.update();
@@ -53,13 +72,13 @@
break;
case send_state:
- pc.printf("Send State\n\r");
+ IF_PRINT_ENABLE(pc.printf("Send State\n\r"););
packet.setState = State_position;
bool ok = receive.write(packet);
if (ok)
- pc.printf("ok.\n\r");
+ IF_PRINT_ENABLE(pc.printf("ok.\n\r"););
else
- pc.printf("failed.\n\r");
+ IF_PRINT_ENABLE(pc.printf("failed.\n\r"););
wait(0.1);
setCurrentState(receive_state);
break;
