RF24Network Send example program.

Dependencies:   xtoff RF24Network mbed

Fork of RF24Network_Send by Akash Vibhute

Committer:
pietor
Date:
Thu Feb 22 14:07:50 2018 +0000
Revision:
7:cbdbaf825b4a
Parent:
6:03ba3e18ced2
Child:
8:62b4607c44ca
Werken 22.02

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 5:e6067799a414 18 struct payload_t {
pietor 5:e6067799a414 19 bool reedsensor;
pietor 7:cbdbaf825b4a 20 float milligram;
pietor 5:e6067799a414 21 };
pietor 5:e6067799a414 22
pietor 6:03ba3e18ced2 23 enum State {State_init,
pietor 6:03ba3e18ced2 24 State_tare,
pietor 6:03ba3e18ced2 25 State_position,
pietor 6:03ba3e18ced2 26 State_read,
pietor 6:03ba3e18ced2 27 State_receive
pietor 6:03ba3e18ced2 28 };
pietor 6:03ba3e18ced2 29
pietor 6:03ba3e18ced2 30 struct state_Packet {
pietor 6:03ba3e18ced2 31 State setstate;
pietor 6:03ba3e18ced2 32 };
pietor 6:03ba3e18ced2 33
pietor 6:03ba3e18ced2 34
pietor 5:e6067799a414 35 class Verzender
pietor 5:e6067799a414 36 {
pietor 5:e6067799a414 37 private:
pietor 5:e6067799a414 38
pietor 5:e6067799a414 39
pietor 5:e6067799a414 40 public:
pietor 5:e6067799a414 41 Verzender();
pietor 5:e6067799a414 42 void update();
pietor 5:e6067799a414 43 bool write(payload_t message);
pietor 6:03ba3e18ced2 44 bool available();
pietor 6:03ba3e18ced2 45 state_Packet read();
pietor 5:e6067799a414 46 };
pietor 5:e6067799a414 47
pietor 5:e6067799a414 48 #endif
pietor 5:e6067799a414 49
pietor 5:e6067799a414 50
pietor 5:e6067799a414 51
pietor 5:e6067799a414 52
pietor 5:e6067799a414 53