This is my change and it is working, thank you for your help.
/**
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2015 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
*******************************
*
* DESCRIPTION
*
* Simple binary switch example
* Connect button or door/window reed switch between
* digitial I/O pin 3 (BUTTON_PIN below) and GND.
* http://www.mysensors.org/build/binary
*/
// Enable debug prints to serial monitor
//#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
#define MY_RF24_PA_LEVEL RF24_PA_LOW
#define MY_NODE_ID 8
#include <SPI.h>
#include <MySensors.h>
#include <Vcc.h>
#define CHILD_ID_MAIL 0
#define CHILD_ID_MAIL2 1
#define CHILD_ID_VOLT 2 // Child id for battery reading
#define BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch
#define BUTTON2_PIN 3 // Arduino Digital I/O pin for button/reed switch
#define SLEEP_TIME 1 * 60 * 1000UL
int oldValueC1=-1;
int oldValueC2=-1;
boolean gwSend = true;
const float VccMin = 3; // Minimum expected Vcc level, in Volts.
const float VccMax = 4; // Maximum expected Vcc level, in Volts.
const float VccCorrection = 1.0/1.0; // Measured Vcc by multimeter divided by reported Vcc
float batteryV = 0;
int batteryPcnt = 0;
Vcc vcc(VccCorrection);
// Change to V_LIGHT if you use S_LIGHT in presentation below
MyMessage msgMail(CHILD_ID_MAIL,V_TRIPPED);
MyMessage msgMail2(CHILD_ID_MAIL2,V_TRIPPED);
MyMessage msgVolt(CHILD_ID_VOLT, V_VOLTAGE);
void setup()
{
// Setup the button
pinMode(BUTTON_PIN, INPUT);
pinMode(BUTTON2_PIN, INPUT);
// Activate internal pull-up
digitalWrite(BUTTON_PIN,HIGH);
digitalWrite(BUTTON2_PIN,HIGH);
#ifdef MY_DEBUG
Serial.begin(115200);
#endif
}
void presentation() {
// Register binary input sensor to gw (they will be created as child devices)
// You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
// If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
sendSketchInfo("BAL", "1.0");
present(CHILD_ID_MAIL, S_DOOR);
present(CHILD_ID_MAIL2, S_DOOR);
present(CHILD_ID_VOLT, S_MULTIMETER);
}
// Check if digital input has changed and send in new value
void loop()
{
wait(100);
// Get the update value
uint8_t volet = digitalRead(BUTTON_PIN);
uint8_t porte = digitalRead(BUTTON2_PIN);
#ifdef MY_DEBUG
Serial.println(volet);
Serial.println(porte);
#endif
if (volet != oldValueC1) {
// Send in the new value
gwSend = true;
#ifdef MY_DEBUG
Serial.println(volet);
#endif
oldValueC1 = volet;
}
if (porte != oldValueC2) {
// Send in the new value
gwSend = true;
#ifdef MY_DEBUG
Serial.println(porte);
#endif
oldValueC2 = porte;
}
batteryV = vcc.Read_Volts();
batteryPcnt = vcc.Read_Perc(VccMin, VccMax);
send(msgVolt.set(batteryV, 2));
sendBatteryLevel(batteryPcnt);
#ifdef MY_DEBUG
//delay(2000);
Serial.println(batteryPcnt);
#endif
if (gwSend == true) {
send(msgMail.set(volet==LOW ? 1 : 0));
send(msgMail2.set(porte==LOW ? 1 : 0));
send(msgVolt.set(batteryV, 2));
sendBatteryLevel(batteryPcnt);
gwSend = false;
}
else {
}
sleep(0, FALLING, 1, FALLING, SLEEP_TIME);
}