RF24Network Send example program.

Dependencies:   xtoff RF24Network mbed

Fork of RF24Network_Send by Akash Vibhute

Committer:
pietor
Date:
Thu Mar 08 09:23:05 2018 +0000
Revision:
8:62b4607c44ca
Parent:
7:cbdbaf825b4a
Child:
9:6d8c0b946259
8/03;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pietor 5:e6067799a414 1 #ifndef Verzender_h
pietor 5:e6067799a414 2 #define Verzender_h
pietor 5:e6067799a414 3 #include "mbed.h"
pietor 5:e6067799a414 4 #include <RF24Network.h>
pietor 5:e6067799a414 5 #include <RF24.h>
pietor 5:e6067799a414 6
pietor 5:e6067799a414 7 #define nrf_CE p9
pietor 5:e6067799a414 8 #define nrf_CSN p8
pietor 5:e6067799a414 9 #define spi_SCK p7
pietor 5:e6067799a414 10 #define spi_MOSI p5
pietor 5:e6067799a414 11 #define spi_MISO p6
pietor 5:e6067799a414 12
pietor 5:e6067799a414 13 const uint16_t this_node = 01;
pietor 5:e6067799a414 14 const uint16_t other_node = 00;
pietor 5:e6067799a414 15 const unsigned long interval = 100; //ms
pietor 5:e6067799a414 16
pietor 5:e6067799a414 17
pietor 8:62b4607c44ca 18
pietor 8:62b4607c44ca 19
pietor 5:e6067799a414 20 struct payload_t {
pietor 5:e6067799a414 21 bool reedsensor;
pietor 7:cbdbaf825b4a 22 float milligram;
pietor 5:e6067799a414 23 };
pietor 5:e6067799a414 24
pietor 6:03ba3e18ced2 25 enum State {State_init,
pietor 6:03ba3e18ced2 26 State_tare,
pietor 6:03ba3e18ced2 27 State_position,
pietor 6:03ba3e18ced2 28 State_read,
pietor 6:03ba3e18ced2 29 State_receive
pietor 6:03ba3e18ced2 30 };
pietor 6:03ba3e18ced2 31
pietor 6:03ba3e18ced2 32 struct state_Packet {
pietor 6:03ba3e18ced2 33 State setstate;
pietor 6:03ba3e18ced2 34 };
pietor 6:03ba3e18ced2 35
pietor 6:03ba3e18ced2 36
pietor 5:e6067799a414 37 class Verzender
pietor 5:e6067799a414 38 {
pietor 5:e6067799a414 39 private:
pietor 5:e6067799a414 40
pietor 5:e6067799a414 41
pietor 5:e6067799a414 42 public:
pietor 5:e6067799a414 43 Verzender();
pietor 5:e6067799a414 44 void update();
pietor 5:e6067799a414 45 bool write(payload_t message);
pietor 6:03ba3e18ced2 46 bool available();
pietor 6:03ba3e18ced2 47 state_Packet read();
pietor 8:62b4607c44ca 48 void test();
pietor 5:e6067799a414 49 };
pietor 5:e6067799a414 50
pietor 5:e6067799a414 51 #endif
pietor 5:e6067799a414 52
pietor 5:e6067799a414 53
pietor 5:e6067799a414 54
pietor 5:e6067799a414 55
pietor 5:e6067799a414 56