How to control the LEDs flash using Serial Monitor

How can I use the Serial Monitor to control three LEDs flashing at the same time, and the blink time is run as the value I type in serial monitor with 'T'?

Show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

Please see the actual wiring as each wire's color the same as the color of each LED light.

Take a look at the serial handling basics topic and the blink without delay example in the IDE.

Post code (all of it, in code tags), not pictures of code.

At a first glance it should be working... what´s happening?

This might be an issue. ESP-8266 signals are 3.3V. If your LED module was designed for 5V...

... the code is incomplete.

And then there's those digtalWrites just before the end of the picture

Sorry the code is complete, just a quote not in the screenshot, I try to control the LED and it works with color change like 'C=125,255,63' , but it's not working at blink.

Please, if you wish us to help follow instructions and suggestion requested from you.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.


Read this:
https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/


Watch these:

1 Like

No, incomplete is simply incomplete.
That's why we ask for actual code, not pictures
What are those digitalWrites supposed to do?

how about


void
setup (void)
{
    Serial.begin (9600);
    pinMode (LED_BUILTIN, OUTPUT);
}

void
loop (void)
{
    if (Serial.available ())  {
        switch (Serial.read ())  {
        case 't':
            digitalWrite (LED_BUILTIN, ! digitalRead (LED_BUILTIN));
            break;
        }
    }
}

Oops...That´s true.

And a line beginning with 'T=' sets the blink time in milliseconds

How can this question be solved please?

Hello
take a view here.

The homework helpline is closed at weekends.

Duplicate post reported

2 Likes

There are at least 3 parts to that... how far have you got? Are you done with the part where you send the r,g,b values without the "c" in front? It seems your "unit 4" whatever that is would provide some help?

I have merged your cross-posts @keviny51 .

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide you will find at the top of every forum category. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Thank you. I have achieved r,g,b values contorl with 'C=', but my code for blink, it does not work at all, I know there must miss something, the problem is that I don't know what is missing. Could you please help me with that?

Your code

1 Like

Well, some gentlemen guys here have been trying to. They asked you to post your complete code instead of a picture of it. To post your code, copy it from Arduino IDE and use the image button in the editor.

They provided you some clues in order for you to find wrong statements in your code. Here is one: if you´re willing to get colors that are different from Red (255,0,0), Green (0,255,0) or Blue (0,0,255), you might use PWM. And to use PWM, the correct command is analogWrite() not digitalWrite().

Edited: Lessons/homeworks are made for you to learn something. People on this Forum seems to respect this fact (which I particularly like, since I´ve been a teacher on the past) and they will avoid simply giving you the solution...

To blink something, merely turning it on is not sufficient.
(Sometimes you just have to state the obvious)