Buenos dias
googleando y trastenado un poco con el IDE de Platformio eh dado con el siguient codigo y me dejo un poco descolocado.
Alguien podria decir si con estra instruccion alterna el valor de la variable booleana "on" pls:)
-->"led*.on = millis()* % 1000 < 50*;" *
*Adjunto el codigo completo que funciona muy bien por cierto *
/**
* ----------------------------------------------------------------------------
* ESP32 Remote Control with WebSocket
* ----------------------------------------------------------------------------
* 漏 2020 St茅phane Calderoni
* ----------------------------------------------------------------------------
*/
#include <Arduino.h>
// ----------------------------------------------------------------------------
// Definition of macros
// ----------------------------------------------------------------------------
#define LED_PIN 26
// ----------------------------------------------------------------------------
// Definition of the Led component
// ----------------------------------------------------------------------------
struct Led {
聽 聽 // state variables
聽 聽 uint8_t pin;
聽 聽 bool聽 聽 on;
聽 聽 // methods
聽 聽 void update() {
聽 聽 聽 聽 digitalWrite(pin, on ? HIGH : LOW);
聽 聽 }
};
// ----------------------------------------------------------------------------
// Definition of global variables
// ----------------------------------------------------------------------------
Led led = { LED_PIN, false };
// ----------------------------------------------------------------------------
// Initialization
// ----------------------------------------------------------------------------
void setup() {
聽 聽 pinMode(led.pin, OUTPUT);
}
// ----------------------------------------------------------------------------
// Main control loop
// ----------------------------------------------------------------------------
void loop() {
聽 聽 led.on = millis() % 1000 < 50;
聽 聽 led.update();
}
Muchas Gracias de Antemano,
Atentamente,
Pablo