Int pay_load=0;
Byte address, Hi, Lo, Config;
Long ADVal;
Char float_str[20];
//LCD
Int sensorValue;
Double tbvValue;
Double tbvValue1;
Double tbvAdcValue;
Int rfm_version;
Int rfm_version1;
Unsigned long cmdpreviousMillis = 0;
Unsigned long previousMillis = 0; // will store last time LED was updated
Unsigned long serialTimeOut=0;
Const long serialinterval=6000;
Int ledState = LOW; // ledState used to set the LED
Const long interval = 1000; // interval at which to blink (milliseconds)
Const long cmdinterval =500;
Bool doorStatus=0;
//SSD1306AsciiAvrI2c oled;
char *ftoa(char *a, double f, int precision)
{
long p[] = {0,10,100,1000,10000,100000,1000000,10000000,100000000};
char *ret = a;
long heiltal = (long)f;
itoa(heiltal, a, 10);
while (*a != '\0') a++;
*a++ = '.';
long desimal = abs((long)((f - heiltal) * p[precision]));
itoa(desimal, a, 10);
return ret;
}
delay(1000);
LoRa.idle();
for (int i = 0; i < 128; i++)
{
Serial.print("0x");
Serial.print(i, HEX);
Serial.print(": 0x");
Serial.print(LoRa.readRegister(i), HEX);
Serial.print(" ");
}
// put the radio into receive mode
Unsigned long currentMillis = millis();
If (currentMillis - previousMillis >= interval)
{
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
If (ledState == LOW) {
ledState = HIGH;
}
Else {
ledState = LOW;
}
// set the LED with the ledState of the variable:
digitalWrite(LED, ledState);
}
}
Void loop() {
Check_nuke();
LED_blink();
sensorValue = analogRead(TBV); // Read Voltage
tbvValue = (sensorValue/20.0)+0.85; //compute value
sensorValue = analogRead(TBV1); // Read Voltage
tbvValue1 = (sensorValue/20.0)+0.85; //compute value
doorStatus =digitalRead(DOOR);
tbvAdcValue= get_adc_tbv();
Serial.print("$$$");
Serial.print(tbvValue);
Serial.print(",");
Serial.print(tbvValue1);
Serial.print(",");
Serial.print(tbvAdcValue);
Serial.print(",");
Serial.print(doorStatus);
Serial.println("$$$");