-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNexusTX.h
46 lines (34 loc) · 903 Bytes
/
NexusTX.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <Arduino.h>
#ifndef NexusTX_h
#define NexusTX_h
#define PULSE_HIGH 500 /* 500 us */
#define PULSE_ZERO 1000 /* 1000 us */
#define PULSE_ONE 2000 /* 2000 us */
#define PULSE_SYNC 4000 /* 4000 us */
// Time between two TX = 56.75 seconds
#define TX_INTERVAL 56750
// Bitstream repetition (this device sends the information 10 times)
#define repeat 12
class NexusTX
{
public:
bool* SendBuffer;
int buffer_size=36;
int tx_interval = TX_INTERVAL;
NexusTX(byte);
void setChannel(byte);
void setId(byte);
void setBatteryFlag(bool);
void setTemperature(float);
void setHumidity(int);
bool transmit();
void SendPacket();
private:
void tx_bit(bool);
byte TX_PIN;
int idx = 0;
void SendNexus();
unsigned long time_marker_send = 0;
unsigned long send_time = TX_INTERVAL;
};
#endif