I am writing a program to control an LED using the Lolin(wemos) d1 mini board and Arduino IDE, and testing it by turning it on and off with my smartphone(blynk IoT). Until recently, I was able to control the LED on or off from my PC or laptop, but for some reason, I can no longer control the LED from my PC or laptop. However, the LED is still working well with my smartphone.
My PC and laptop are using windows10.
I am using digital types for datastreams.
I have same result after rebooting.
I have several wemos modules but only one device on testing.
I am a teacher in South Korea.
Last semester, I successfully taught my students with the same parts and the same program.
But since last July, I can’t control it on my PC or laptop.
I have tested with several wemos modules before the class and they all give the same result.
So I thought that the ability to control it from a PC was gone.
Again, I can use the LEDs on the wemos module with the smartphone app without any problems.
What could be the problem?
Of course, I’m using the same account.
However, while testing again today, I noticed something very unusual. I was able to turn off the LED on the Wemos module from my PC.
However, to turn on the LED, I had to use my smartphone. I can’t turn it on from the PC, but I can turn it off.
And every time I turned the “BlueLed” button on/off on the PC, the button would move a little bit to the left, but then return to its original position. At the same time, I can see that the LED on the wemos flashes every time I move the button on the PC. That means it’s responding.
However, even though I can turn it on/off on my smartphone, I can only turn it off on my PC.
Why is this behavior?
I set the BlueLed of wemos to digital type.
This source code is in its early stages and in the next step I will introduce better code to students like interrupt code(attachInterrupt).
The current problem used to work well in the past, so I’ll study it a little more.
Thank you for helping me.
But before you do that you should remove the blocking delays, use GPIO numbers exclusively rather than “D” designations, use log.event more sensibly, stop using legacy WidgetLED, use BlynkTimer rather than SimpleTimer, and use virtual datastreams rather than digital.
The reason why D1 and D4 are used is because they use the wemos module, which tells students that D4 is the same as GPIO2. I think it is more educational to do so.
SimpleTimer is also more helpful to students when compared to BlynkTimer.
Anyway, thank you again for your help
I agree with you about the compatibility of the code.
However, I think it’s important to present that process to students and gradually introduce them to good examples of better code.
Thanks for your advice, as always.