Hello,
I need some advises to improve the program to control roller shutters.
I have 8 roller shutters that I want to control this way : individually or generally.
Harware is like this :
The buttons (individual or general) have 3 positions :
up=0 and down=0
up=1 and down=0
up=0 and down=1
I have created a program that is always recording the latest button status change, here is the program :
The issue is that when a roller shutter is going up or down, then switching another button has no effect. In fact I should wait for the task that is involved for the moving roller is finished. I really want to have things working in parallel.
Do you have tips ?
Thanks
Denis
I need some advises to improve the program to control roller shutters.
I have 8 roller shutters that I want to control this way : individually or generally.
Harware is like this :
C:
// Individual input buttons
int buttonUp[] = {1, 3, 5, 7, 9, 11, 12, 14};
int buttonDown[] = {0, 2, 4, 6, 8, 10, 13, 15};
// Output to control motor up or down
int motorUp[] = {17, 19, 21, 23, 31, 33, 34, 36};
int motorDown[] = {16, 18, 20, 22, 30, 32, 35, 37};
// General input
int buttonCentralizedUp = 28;
int buttonCentralizedDown = 29;
The buttons (individual or general) have 3 positions :
up=0 and down=0
up=1 and down=0
up=0 and down=1
I have created a program that is always recording the latest button status change, here is the program :
C:
/*
* Shutter program for Teesy 4.1
*
* Version : 2024-Sep-12
*
* Input pin on Port A ***************************************
* PA | Room | Teensy | PA | Room | Teensy
* -----------------------------------------------------------
* A1 | Salon up | D1 | A0 | Salon down | D0
* A2 | Bathroom up | D3 | A3 | Bathroom down | D2
* A4 | Erine up | D5 | A5 | Erine down | D4
* A6 | Eva up | D7 | A7 | Eva down | D6
* A8 | Laura up | D9 | A9 | Laura down | D8
* A10 | sam up | D11 | A11 | sam down | D10
* A12 | kitchen up | D13 | A13 | Kitchen down | D12
* A14 | Cellier up | D15 | A15 | Cellier down | D14
* ------------------------------------------------------------
*
* Output pin on Port B **************************************
* PB | Room | Teensy | PB | Room | Teensy
* -----------------------------------------------------------
* B0 | Salon up | D17 | B1 | Salon down | D16
* B2 | Bathroom up | D19 | B3 | Bathroom down | D18
* B4 | Erine up | D21 | B5 | Erine down | D20
* B6 | Eva up | D23 | B7 | Eva down | D22
* B8 | Laura up | D31 | B9 | Laura down | D30
* B10 | sam up | D33 | B11 | sam down | D32
* B12 | kitchen up | D35 | B13 | Kitchen down | D34
* B14 | Cellier up | D37 | B15 | Cellier down | D36
*
* Input pin on Port General *********************************
* Pg | Room | Teensy
* ----------------------------
* PG0 | General up | D28
* PG1 | General down | D29
*
* 74LVC4245 direction control *******************************
* PortA = DirA = D40
* PortB = DirB = D41
*
* LED *******************************************************
* L1 = D26
* L2 = D27
* L3 = D38
* L4 = D39
*
* @author Denis MORIN
*/
#include <TaskScheduler.h>
#include <Wire.h>
#include "Watchdog_t4.h"
WDT_T4<WDT1> wdt;
char const *VERSION = "V2024-Nov-26";
// Timing for shutters
const int SMALL = 15000;
const int MEDIUM = 20000;
const int BIG = 45000;
// Input
int buttonUp[] = {1, 3, 5, 7, 9, 11, 12, 14};
int buttonDown[] = {0, 2, 4, 6, 8, 10, 13, 15};
// Output (Note that kitchen and cellier are the other way around)
int motorUp[] = {17, 19, 21, 23, 31, 33, 34, 36};
int motorDown[] = {16, 18, 20, 22, 30, 32, 35, 37};
// Input general
int buttonCentralizedUp = 28;
int buttonCentralizedDown = 29;
// 74LVC4245
int dirA = 40;
int dirB = 41;
// LED
int led1 = 26;
int led2 = 27;
int led3 = 38;
int led4 = 39;
// I2C
volatile byte fromIIC = 0; // Command received from I2C
byte msg[2]; // Store message in a long (2 bytes)
// Global variable for button status
int salonUp = 0;
int salonDown = 0;
int salonUpChanged = 0;
int salonDownChanged = 0;
int salonForceUp = 0;
int salonForceDown = 0;
int sdbUp = 0;
int sdbDown = 0;
int sdbUpChanged = 0;
int sdbDownChanged = 0;
int sdbForceUp = 0;
int sdbForceDown = 0;
int erineUp = 0;
int erineDown = 0;
int erineUpChanged = 0;
int erineDownChanged = 0;
int erineForceUp = 0;
int erineForceDown = 0;
int evaUp = 0;
int evaDown = 0;
int evaUpChanged = 0;
int evaDownChanged = 0;
int evaForceUp = 0;
int evaForceDown = 0;
int lauraUp = 0;
int lauraDown = 0;
int lauraUpChanged = 0;
int lauraDownChanged = 0;
int lauraForceUp = 0;
int lauraForceDown = 0;
int samUp = 0;
int samDown = 0;
int samUpChanged = 0;
int samDownChanged = 0;
int samForceUp = 0;
int samForceDown = 0;
int cuisineUp = 0;
int cuisineDown = 0;
int cuisineUpChanged = 0;
int cuisineDownChanged = 0;
int cuisineForceUp = 0;
int cuisineForceDown = 0;
int cellierUp = 0;
int cellierDown = 0;
int cellierUpChanged = 0;
int cellierDownChanged = 0;
int cellierForceUp = 0;
int cellierForceDown = 0;
int genUp = 0;
int genDown = 0;
int genUpChanged = 0;
int genDownChanged = 0;
int genForceUp = 0;
int genForceDown = 0;
void taskButtons();
void taskSalon();
void taskSdb();
void taskErine();
void taskEva();
void taskLaura();
void taskSam();
void taskCuisine();
void taskCellier();
void taskGeneral();
// Tasks
Scheduler runner;
Task tButtons(100, TASK_FOREVER, &taskButtons, &runner, true);
Task tSalon(100, TASK_FOREVER, &taskSalon, &runner, true);
Task tSdb(100, TASK_FOREVER, &taskSdb, &runner, true);
Task tErine(100, TASK_FOREVER, &taskErine, &runner, true);
Task tEva(100, TASK_FOREVER, &taskEva, &runner, true);
Task tLaura(100, TASK_FOREVER, &taskLaura, &runner, true);
Task tSam(100, TASK_FOREVER, &taskSam, &runner, true);
Task tCuisine(100, TASK_FOREVER, &taskCuisine, &runner, true);
Task tCellier(100, TASK_FOREVER, &taskCellier, &runner, true);
Task tGeneral(100, TASK_FOREVER, &taskGeneral, &runner, true);
// Task testing button changes
void taskButtons() {
// Salon
if (salonUp != digitalRead(buttonUp[0])) {
salonUp = digitalRead(buttonUp[0]);
salonForceUp = 0;
salonForceDown = 0;
if (salonUp != 0) {salonUpChanged = 1;}
else {salonUpChanged = 0;}
}
if (salonDown != digitalRead(buttonDown[0])) {
salonDown = digitalRead(buttonDown[0]);
salonForceUp = 0;
salonForceDown = 0;
if (salonDown != 0) {salonDownChanged = 1;}
else {salonDownChanged = 0;}
}
// Sdb
if (sdbUp != digitalRead(buttonUp[1])) {
sdbUp = digitalRead(buttonUp[1]);
sdbForceUp = 0;
sdbForceDown = 0;
if (sdbUp != 0) { sdbUpChanged = 1;}
else { sdbUpChanged = 0;}
}
if (sdbDown != digitalRead(buttonDown[1])) {
sdbDown = digitalRead(buttonDown[1]);
sdbForceUp = 0;
sdbForceDown = 0;
if (sdbDown != 0) {sdbDownChanged = 1;}
else {sdbDownChanged = 0;}
}
// Erine
if (erineUp != digitalRead(buttonUp[2])) {
erineUp = digitalRead(buttonUp[2]);
erineForceUp = 0;
erineForceDown = 0;
if (erineUp != 0) {erineUpChanged = 1;}
else {erineUpChanged = 0;}
}
if (erineDown != digitalRead(buttonDown[2])) {
erineDown = digitalRead(buttonDown[2]);
erineForceUp = 0;
erineForceDown = 0;
if (erineDown != 0) {erineDownChanged = 1;}
else {erineDownChanged = 0;}
}
// Eva
if (evaUp != digitalRead(buttonUp[3])) {
evaUp = digitalRead(buttonUp[3]);
evaForceUp = 0;
evaForceDown = 0;
if (evaUp != 0) {evaUpChanged = 1;}
else {evaUpChanged = 0;}
}
if (evaDown != digitalRead(buttonDown[3])) {
evaDown = digitalRead(buttonDown[3]);
evaForceUp = 0;
evaForceDown = 0;
if (evaDown != 0) {evaDownChanged = 1;}
else {evaDownChanged = 0;}
}
// Laura
if (lauraUp != digitalRead(buttonUp[4])) {
lauraUp = digitalRead(buttonUp[4]);
lauraForceUp = 0;
lauraForceDown = 0;
if (lauraUp != 0) {lauraUpChanged = 1;}
else {lauraUpChanged = 0;}
}
if (lauraDown != digitalRead(buttonDown[4])) {
lauraDown = digitalRead(buttonDown[4]);
lauraForceUp = 0;
lauraForceDown = 0;
if (lauraDown != 0) {lauraDownChanged = 1;}
else {lauraDownChanged = 0;}
}
// Sam
if (samUp != digitalRead(buttonUp[5])) {
samUp = digitalRead(buttonUp[5]);
samForceUp = 0;
samForceDown = 0;
if (samUp != 0) {samUpChanged = 1;}
else {samUpChanged = 0;}
}
if (samDown != digitalRead(buttonDown[5])) {
samDown = digitalRead(buttonDown[5]);
samForceUp = 0;
samForceDown = 0;
if (samDown != 0) {samDownChanged = 1;}
else {samDownChanged = 0;}
}
// Cuisine
if (cuisineUp != digitalRead(buttonUp[6])) {
cuisineUp = digitalRead(buttonUp[6]);
cuisineForceUp = 0;
cuisineForceDown = 0;
if (cuisineUp != 0) {cuisineUpChanged = 1;}
else {cuisineUpChanged = 0;}
}
if (cuisineDown != digitalRead(buttonDown[6])) {
cuisineDown = digitalRead(buttonDown[6]);
cuisineForceUp = 0;
cuisineForceDown = 0;
if (cuisineDown != 0) {cuisineDownChanged = 1;}
else {cuisineDownChanged = 0;}
}
// Cellier
if (cellierUp != digitalRead(buttonUp[7])) {
cellierUp = digitalRead(buttonUp[7]);
cellierForceUp = 0;
cellierForceDown = 0;
if (cellierUp != 0) {cellierUpChanged = 1;}
else {cellierUpChanged = 0;}
}
if (cellierDown != digitalRead(buttonDown[7])) {
cellierDown = digitalRead(buttonDown[7]);
cellierForceUp = 0;
cellierForceDown = 0;
if (cellierDown != 0) {cellierDownChanged = 1;}
else {cellierDownChanged = 0;}
}
// Gen
if (genUp != digitalRead(buttonCentralizedUp)) {
genUp = digitalRead(buttonCentralizedUp);
genForceUp = 0;
genForceDown = 0;
if (genUp != 0) {genUpChanged = 1;}
else {genUpChanged = 0;}
}
if (genDown != digitalRead(buttonCentralizedDown)) {
genDown = digitalRead(buttonCentralizedDown);
genForceUp = 0;
genForceDown = 0;
if (genDown != 0) {genDownChanged = 1;}
else {genDownChanged = 0;}
}
}
// Salon
void taskSalon() {
// Check if button status changed
if (salonUpChanged == 1) {
salonUpChanged = 0;
digitalWrite(motorDown[0], HIGH);
digitalWrite(motorUp[0], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonUp[0]) == 1) || (salonForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[0], HIGH);
salonForceUp = 0;
}
// Check if button status changed
if (salonDownChanged == 1) {
salonDownChanged = 0;
digitalWrite(motorUp[0], HIGH);
digitalWrite(motorDown[0], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonDown[0]) == 1) || (salonForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[0], HIGH);
salonForceDown = 0;
}
}
// Salle de bain
void taskSdb() {
// Check if button status changed
if (sdbUpChanged == 1) {
sdbUpChanged = 0;
digitalWrite(motorDown[1], HIGH);
digitalWrite(motorUp[1], LOW);
int timout = 0;
while((timout < SMALL) && ((digitalRead(buttonUp[1]) == 1) || (sdbForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[1], HIGH);
sdbForceUp = 0;
}
// Check if button status changed
if (sdbDownChanged == 1) {
sdbDownChanged = 0;
digitalWrite(motorUp[1], HIGH);
digitalWrite(motorDown[1], LOW);
int timout = 0;
while((timout < SMALL) && ((digitalRead(buttonDown[1]) == 1) || (sdbForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[1], HIGH);
sdbForceDown = 0;
}
}
// Erine
void taskErine() {
// Check if button status changed
if (erineUpChanged == 1) {
erineUpChanged = 0;
digitalWrite(motorDown[2], HIGH);
digitalWrite(motorUp[2], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonUp[2]) == 1) || (erineForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[2], HIGH);
erineForceUp = 0;
}
// Check if button status changed
if (erineDownChanged == 1) {
erineDownChanged = 0;
digitalWrite(motorUp[2], HIGH);
digitalWrite(motorDown[2], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonDown[2]) == 1) || (erineForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[2], HIGH);
erineForceDown = 0;
}
}
// Eva
void taskEva() {
// Check if button status changed
if (evaUpChanged == 1) {
evaUpChanged = 0;
digitalWrite(motorDown[3], HIGH);
digitalWrite(motorUp[3], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonUp[3]) == 1) || (evaForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[3], HIGH);
evaForceUp = 0;
}
// Check if button status changed
if (evaDownChanged == 1) {
evaDownChanged = 0;
digitalWrite(motorUp[3], HIGH);
digitalWrite(motorDown[3], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonDown[3]) == 1) || (evaForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[3], HIGH);
evaForceDown = 0;
}
}
// Laura
void taskLaura() {
// Check if button status changed
if (lauraUpChanged == 1) {
lauraUpChanged = 0;
digitalWrite(motorDown[4], HIGH);
digitalWrite(motorUp[4], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonUp[4]) == 1) || (lauraForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[4], HIGH);
lauraForceUp = 0;
}
// Check if button status changed
if (lauraDownChanged == 1) {
lauraDownChanged = 0;
digitalWrite(motorUp[4], HIGH);
digitalWrite(motorDown[4], LOW);
int timout = 0;
while((timout < MEDIUM) && ((digitalRead(buttonDown[4]) == 1) || (lauraForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[4], HIGH);
lauraForceDown = 0;
}
}
// Salle a manger
void taskSam() {
// Check if button status changed
if (samUpChanged == 1) {
samUpChanged = 0;
digitalWrite(motorDown[5], HIGH);
digitalWrite(motorUp[5], LOW);
int timout = 0;
while((timout < BIG) && ((digitalRead(buttonUp[5]) == 1) || (samForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[5], HIGH);
samForceUp = 0;
}
// Check if button status changed
if (samDownChanged == 1) {
samDownChanged = 0;
digitalWrite(motorUp[5], HIGH);
digitalWrite(motorDown[5], LOW);
int timout = 0;
while((timout < BIG) && ((digitalRead(buttonDown[5]) == 1) || (samForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[5], HIGH);
samForceDown = 0;
}
}
// Cuisine
void taskCuisine() {
// Check if button status changed
if (cuisineUpChanged == 1) {
cuisineUpChanged = 0;
digitalWrite(motorDown[6], HIGH);
digitalWrite(motorUp[6], LOW);
int timout = 0;
while((timout < BIG) && ((digitalRead(buttonUp[6]) == 1) || (cuisineForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[6], HIGH);
cuisineForceUp = 0;
}
// Check if button status changed
if (cuisineDownChanged == 1) {
cuisineDownChanged = 0;
digitalWrite(motorUp[6], HIGH);
digitalWrite(motorDown[6], LOW);
int timout = 0;
while((timout < BIG) && ((digitalRead(buttonDown[6]) == 1) || (cuisineForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[6], HIGH);
cuisineForceDown = 0;
}
}
// Cellier
void taskCellier() {
// Check if button status changed
if (cellierUpChanged == 1) {
cellierUpChanged = 0;
digitalWrite(motorDown[7], HIGH);
digitalWrite(motorUp[7], LOW);
int timout = 0;
while((timout < SMALL) && ((digitalRead(buttonUp[7]) == 1) || (cellierForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[7], HIGH);
cellierForceUp = 0;
}
// Check if button status changed
if (cellierDownChanged == 1) {
cellierDownChanged = 0;
digitalWrite(motorUp[7], HIGH);
digitalWrite(motorDown[7], LOW);
int timout = 0;
while((timout < SMALL) && ((digitalRead(buttonDown[7]) == 1) || (cellierForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[7], HIGH);
cellierForceDown = 0;
}
}
// General
void taskGeneral() {
digitalWrite(led1, !digitalRead(led1));
// Check if button status changed
if (genUpChanged == 1) {
genUpChanged = 0;
digitalWrite(motorDown[0], HIGH);
digitalWrite(motorDown[1], HIGH);
digitalWrite(motorDown[2], HIGH);
digitalWrite(motorDown[3], HIGH);
digitalWrite(motorDown[4], HIGH);
digitalWrite(motorDown[5], HIGH);
digitalWrite(motorDown[6], HIGH);
digitalWrite(motorDown[7], HIGH);
digitalWrite(motorUp[0], LOW);
digitalWrite(motorUp[1], LOW);
digitalWrite(motorUp[2], LOW);
digitalWrite(motorUp[3], LOW);
digitalWrite(motorUp[4], LOW);
digitalWrite(motorUp[5], LOW);
digitalWrite(motorUp[6], LOW);
digitalWrite(motorUp[7], LOW);
int timout = 0;
while((timout < BIG) && ((digitalRead(buttonCentralizedUp) == 1) || (genForceUp == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorUp[0], HIGH);
digitalWrite(motorUp[1], HIGH);
digitalWrite(motorUp[2], HIGH);
digitalWrite(motorUp[3], HIGH);
digitalWrite(motorUp[4], HIGH);
digitalWrite(motorUp[5], HIGH);
digitalWrite(motorUp[6], HIGH);
digitalWrite(motorUp[7], HIGH);
genForceUp = 0;
}
// Check if button status changed
if (genDownChanged == 1) {
genDownChanged = 0;
digitalWrite(motorUp[0], HIGH);
digitalWrite(motorUp[1], HIGH);
digitalWrite(motorUp[2], HIGH);
digitalWrite(motorUp[3], HIGH);
digitalWrite(motorUp[4], HIGH);
digitalWrite(motorUp[5], HIGH);
digitalWrite(motorUp[6], HIGH);
digitalWrite(motorUp[7], HIGH);
digitalWrite(motorDown[0], LOW);
digitalWrite(motorDown[1], LOW);
digitalWrite(motorDown[2], LOW);
digitalWrite(motorDown[3], LOW);
digitalWrite(motorDown[4], LOW);
digitalWrite(motorDown[5], LOW);
digitalWrite(motorDown[6], LOW);
digitalWrite(motorDown[7], LOW);
int timout = 0;
while((timout < BIG) && ((digitalRead(buttonCentralizedDown) == 1) || (genForceDown == 1))) {
delay(1);
wdt.feed();
timout++;
}
// Motor off
digitalWrite(motorDown[0], HIGH);
digitalWrite(motorDown[1], HIGH);
digitalWrite(motorDown[2], HIGH);
digitalWrite(motorDown[3], HIGH);
digitalWrite(motorDown[4], HIGH);
digitalWrite(motorDown[5], HIGH);
digitalWrite(motorDown[6], HIGH);
digitalWrite(motorDown[7], HIGH);
genForceDown = 0;
}
}
// Receive event from I2C
void receiveEvent(int howMany) {
while (Wire2.available() > 0) {
digitalWrite(led2, !digitalRead(led2));
fromIIC = Wire.read();
}
}
// Request event from I2C
void requestEvent(void) {
digitalWrite(led3, !digitalRead(led3));
Wire2.write(msg[0]);
Wire2.write(msg[1]);
}
void doReboot() {
// Reboot
SCB_AIRCR = 0x05FA0004;
}
//------------------------------------------------------------------------------
void setup() {
// Pin mode
for (int i = 0; i <= 7; i++) {
pinMode(buttonUp[i], INPUT_PULLDOWN);
pinMode(buttonDown[i], INPUT_PULLDOWN);
}
for (int i = 0; i <= 7; i++) {
pinMode(motorUp[i], OUTPUT);
pinMode(motorDown[i], OUTPUT);
}
pinMode(buttonCentralizedUp, INPUT_PULLDOWN);
pinMode(buttonCentralizedDown, INPUT_PULLDOWN);
pinMode(dirA, OUTPUT);
pinMode(dirB, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
// Watchdog
WDT_timings_t config;
config.trigger = 30; /* in seconds, 0->128 */
config.timeout = 60; /* in seconds, 0->128 */
config.callback = doReboot;
wdt.begin(config);
// Default output values
digitalWrite(dirA, HIGH); // Output (A data to B bus on 74LVC4245)
digitalWrite(dirB, LOW); // Input (B data to A bus on 74LVC4245)
for (int i = 0; i <= 7; i++) {
digitalWrite(motorUp[i], HIGH);
digitalWrite(motorDown[i], HIGH);
}
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
// Read button status
salonUp = digitalRead(buttonUp[0]);
salonDown = digitalRead(buttonDown[0]);
sdbUp = digitalRead(buttonUp[1]);
sdbDown = digitalRead(buttonDown[1]);
erineUp = digitalRead(buttonUp[2]);
erineDown = digitalRead(buttonDown[2]);
evaUp = digitalRead(buttonUp[3]);
evaDown = digitalRead(buttonDown[3]);
lauraUp = digitalRead(buttonUp[4]);
lauraDown = digitalRead(buttonDown[4]);
samUp = digitalRead(buttonUp[5]);
samDown = digitalRead(buttonDown[5]);
cuisineUp = digitalRead(buttonUp[6]);
cuisineDown = digitalRead(buttonDown[6]);
cellierUp = digitalRead(buttonUp[7]);
cellierDown = digitalRead(buttonDown[7]);
genUp = digitalRead(buttonCentralizedUp);
genDown = digitalRead(buttonCentralizedDown);
// I2C Slave setup at address 8
Wire2.begin(0x08);
// Register event
Wire2.onReceive(receiveEvent);
Wire2.onRequest(requestEvent);
// Task
runner.startNow();
}
//------------------------------------------------------------------------------
void loop() {
// To let know watchdog we are still alive
static uint32_t callback_test = millis();
if ( millis() - callback_test > 5500 ) {
callback_test = millis();
wdt.feed();
digitalWrite(led4, !digitalRead(led4));
}
// Task
runner.execute();
}
The issue is that when a roller shutter is going up or down, then switching another button has no effect. In fact I should wait for the task that is involved for the moving roller is finished. I really want to have things working in parallel.
Do you have tips ?
Thanks
Denis