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
Transmitter.h
00001 #ifndef Transmitter_h 00002 #define Transmitter_h 00003 #include "mbed.h" 00004 #include <RF24Network.h> 00005 #include <RF24.h> 00006 00007 #define nrf_CE D4 00008 #define nrf_CSN D3 00009 #define spi_SCK A1 00010 #define spi_MOSI A6 00011 #define spi_MISO A5 00012 00013 #ifdef PRINT_ENABLE 00014 #define IF_PRINT_ENABLE(x) ({x;}) 00015 #else 00016 #define IF_PRINT_ENABLE(x) 00017 #endif 00018 00019 00020 //Identification verzender/ontvanger 00021 const uint16_t this_node = 01; 00022 const uint16_t other_node = 00; 00023 00024 00025 // 00026 struct payload_t { 00027 char command; 00028 float mass; 00029 bool messageAvailable; 00030 }; 00031 00032 enum State2 {init_state, 00033 testConnection_state, 00034 send_state, 00035 receive_state, 00036 }; 00037 00038 enum State {State_init, 00039 State_tare, 00040 State_position, 00041 State_read, 00042 State_send, 00043 State_receive, 00044 State_calibrate 00045 }; 00046 00047 00048 00049 class Ontvanger 00050 { 00051 private: 00052 00053 00054 public: 00055 Ontvanger(); 00056 void update(); 00057 bool available(); 00058 void printDetails(); 00059 bool write(payload_t message); 00060 payload_t read(); 00061 bool writeArray(char *); 00062 char * readArray(); 00063 bool isValid(); 00064 bool testRPD(); 00065 void printMessage(char index); 00066 }; 00067 00068 #endif 00069 00070 00071 00072 00073
Generated on Tue Jul 19 2022 01:01:54 by
