Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question from a user from Germany #24

Open
oldtimerfrake opened this issue Feb 9, 2022 · 0 comments
Open

Question from a user from Germany #24

oldtimerfrake opened this issue Feb 9, 2022 · 0 comments

Comments

@oldtimerfrake
Copy link

Hello Stéphane,
a really nice project! Could you perhaps publish the code from #13 again? I tried to implement your code for several LEDs and buttons but it doesn't work. The leds on the breadboard work (2 leds, 2 buttons) but the dashboard does not. There are problems with: function onMessage(event) {
let data = JSON.parse(event.data);
document.getElementById('led_' + data.rank).className = data.status;
} specifically with 'led_' + data.rank.
Is that right?
String processor(const String &var) {
return String(var == "STATE_1" && led[0].on ? "on" : "off" );

}
and: void notifyClients() {
ws.textAll(led[0].on ? "on" : "off" );
}

void handleWebSocketMessage(void *arg, uint8_t data, size_t len) {
AwsFrameInfo info = (AwsFrameInfo)arg;
if (info->final && info->index == 0 && info->len == len && info->opcode == WS_TEXT) {
data[len] = 0;
if (strcmp((char
)data, "toggle") == 0) {
led[0].on = !led[0].on;
notifyClients();
}
}
I don't think so.
led[0].on = !led[0].on;

How do you think that?........

(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant