/*
Protocolo
*/
#define OTTA
//#define ABP
// untested example for all pins of all Arduinos
//#define TOGGLE(x) digitalWrite(x, digitalRead(x) ? LOW : HIGH)
//TOGGLE(13);
uint8_t teste = 0xFA;
struct Header {
uint8_t h1;
uint8_t h2;
uint8_t h3;
uint16_t h4;
};
//Struct de 1 byte
struct Timo{
byte PF:1; //1bit
byte DBD:1;
byte XU:1;
};
Header header;
Timo timo;
void setup() {
Serial.begin(115200);
Serial.println("Teste");
Serial.print("0x");
Serial.print(teste < 16 ? "0" : "");
Serial.println(teste, HEX);
header.h1 = 0x01;
header.h2 = 0xA2;
header.h3 = 0x07;
Serial.print("Size of struct = ");
Serial.println(sizeof(Header)); //número de bytes da struct Header
Serial.print("0x");
Serial.print(header.h1 < 16 ? "0" : "");
Serial.println(header.h1, HEX);
Serial.print("0x");
Serial.print(header.h2 < 16 ? "0" : "");
Serial.println(header.h2, HEX);
Serial.print("0x");
Serial.print(header.h3 < 16 ? "0" : "");
Serial.println(header.h3, HEX);
Serial.println(bitRead(header.h3, 3));
Serial.print("Size of struct Timo = ");
Serial.println(sizeof(Timo)); //número de bytes da struct Timo
timo.PF = 1;
timo.DBD = 0;
timo.XU = 1;
Serial.print("timo.PF = ");
Serial.println(timo.PF);
}
void loop() {
// put your main code here, to run repeatedly:
}