0.2
This commit is contained in:
parent
c5b402a1b4
commit
3eb2a581bb
|
@ -3,31 +3,46 @@
|
||||||
#define MY_RADIO_RF24
|
#define MY_RADIO_RF24
|
||||||
// #define MY_RF24_PA_LEVEL RF24_PA_MIN
|
// #define MY_RF24_PA_LEVEL RF24_PA_MIN
|
||||||
// #define MY_RF24_PA_LEVEL RF24_PA_LOW
|
// #define MY_RF24_PA_LEVEL RF24_PA_LOW
|
||||||
#define MY_RF24_PA_LEVEL RF24_PA_HIGH
|
// #define MY_RF24_PA_LEVEL RF24_PA_HIGH
|
||||||
//#define MY_RF24_PA_LEVEL RF24_PA_MAX
|
#define MY_RF24_PA_LEVEL RF24_PA_MAX
|
||||||
|
|
||||||
#define MY_RF24_CHANNEL 14
|
#define MY_RF24_CHANNEL 14
|
||||||
|
|
||||||
#define MY_REPEATER_FEATURE
|
#define MY_REPEATER_FEATURE
|
||||||
|
|
||||||
|
#define MY_DEFAULT_RX_LED_PIN A0
|
||||||
|
#define MY_DEFAULT_TX_LED_PIN A1
|
||||||
|
#define MY_DEFAULT_ERR_LED_PIN A2
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <MySensors.h>
|
#include <MySensors.h>
|
||||||
|
|
||||||
|
// https://lastminuteengineers.com/multiple-ds18b20-arduino-tutorial/
|
||||||
|
#include <OneWire.h>
|
||||||
|
#include <DallasTemperature.h>
|
||||||
|
|
||||||
|
// Data wire is plugged into port 11 on the Arduino
|
||||||
|
#define ONE_WIRE_BUS 7
|
||||||
|
// Setup a oneWire instance to communicate with any OneWire devices
|
||||||
|
OneWire oneWire(ONE_WIRE_BUS);
|
||||||
|
|
||||||
|
// Pass our oneWire reference to Dallas Temperature.
|
||||||
|
DallasTemperature sensors(&oneWire);
|
||||||
|
|
||||||
#define ROTATION_CHILD_ID 0
|
#define ROTATION_CHILD_ID 0
|
||||||
|
#define CHILD_ID_TEMP 1
|
||||||
|
|
||||||
MyMessage dimmerMsg(ROTATION_CHILD_ID, V_DIMMER);
|
MyMessage dimmerMsg(ROTATION_CHILD_ID, V_DIMMER);
|
||||||
MyMessage lightMsg(ROTATION_CHILD_ID, V_LIGHT); // we need init light message to make the dimmer appear in HA
|
MyMessage lightMsg(ROTATION_CHILD_ID, V_LIGHT); // we need init light message to make the dimmer appear in HA
|
||||||
|
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
control a 28BYJ-48 stepper motor with ULN2003 driver board
|
control a 28BYJ-48 stepper motor with ULN2003 driver board
|
||||||
https://www.makerguides.com/28byj-48-stepper-motor-arduino-tutorial/
|
https://www.makerguides.com/28byj-48-stepper-motor-arduino-tutorial/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Stepper.h"
|
#include "Stepper.h"
|
||||||
|
|
||||||
// Define number of steps per rotation:
|
// Define number of steps per rotation:
|
||||||
const int stepsPerRevolution = 2048; // can be 4096
|
const int stepsPerRevolution = 2048; // can be 4096
|
||||||
|
|
||||||
// ULN2003 Wiring:
|
// ULN2003 Wiring:
|
||||||
// Pin 3 to IN1
|
// Pin 3 to IN1
|
||||||
// Pin 4 to IN2
|
// Pin 4 to IN2
|
||||||
|
@ -41,15 +56,21 @@ int prevDimValue=0;
|
||||||
int newDimValue=0;
|
int newDimValue=0;
|
||||||
char convBuffer[10];
|
char convBuffer[10];
|
||||||
|
|
||||||
|
|
||||||
|
float DTemp;
|
||||||
|
float old_DTemp;
|
||||||
|
|
||||||
|
|
||||||
void presentation()
|
void presentation()
|
||||||
{
|
{
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
Serial.println("- - - - - presentation - - - - -");
|
Serial.println("- - - - - presentation - - - - -");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sendSketchInfo("Registre Air Chaud", "0.1");
|
sendSketchInfo("Registre Air Chaud", "0.2");
|
||||||
|
|
||||||
present(ROTATION_CHILD_ID, S_DIMMER, "rotation");
|
present(ROTATION_CHILD_ID, S_DIMMER, "rotation");
|
||||||
|
present(CHILD_ID_TEMP, S_TEMP, "Temperature");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -63,12 +84,24 @@ void setup() {
|
||||||
|
|
||||||
send(dimmerMsg.set(prevDimValue));
|
send(dimmerMsg.set(prevDimValue));
|
||||||
send(lightMsg.set(1));
|
send(lightMsg.set(1));
|
||||||
|
|
||||||
|
sensors.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
// Serial.println("- - - - - loop - - - - -");
|
// Serial.println("- - - - - loop - - - - -");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
sensors.requestTemperatures();
|
||||||
|
old_DTemp = DTemp;
|
||||||
|
DTemp = sensors.getTempCByIndex(0);
|
||||||
|
if (DTemp != old_DTemp && DTemp != -127)
|
||||||
|
{
|
||||||
|
send(msgTemp.set(DTemp, 1));
|
||||||
|
old_DTemp = DTemp;
|
||||||
|
}
|
||||||
|
|
||||||
delay(5000);
|
delay(5000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue