Why does the white led get on and off and get a blue

Delete the IR parts from the diagram window…

When I did that too, having already removed all the IR stuff from the code, it worked.

Of course it did.

The very presence of the IR part(s) messes something up.

No real world analogy to that!

When I can I'll see if the boys over at wokwi have a clue.

a7

Floating the mouse over the screen here, I can see some effect on the LEDs brightness.

Perhaps something temporary or some website update that changed the way the graphic elements are displayed.

I did the same with tinkercad here : Login - Tinkercad

And there everything works well no blinking

So it safe to conclude that wokwiki is too blame or do you experts think otherwise

I’m far from expert, but yes, I do think something is not sweet in Wokwi today.

I have it longer.

Could it maybe be a browser problem?

I work in Firefox.

or make a bug report on the github of wokwi ?

I have tested the conclusions I thought were conclusions in #21.

This is completely baffling. I tried adding IR components to the RGB LED demo sketch provided by wokwi, expecting that to break it; it did not.

So just now, I got nothing.

a7

YOu cannot break it or the problem did not shown ?

I filled in a bug report : RGB led does not work with a solid white color · Issue #1076 · wokwi/wokwi-features · GitHub

Lets see what the wokwi people say about it.

On Iphone Wokwi earlier repeatedly crashed while simulating. Displayed a long error number but I was too slow to capture.

When the RED LED is on you switch BLUE ON this gives PURPLE than adding GREEN makes it white.

The loop just runs continues and nothing is switched off , so the LED stays WHITE.

Switch RED off then select a new color.

Edit. There is no delay between the LED switching so you cant see the colors change.
You only see WHITE.

So you do not see any blinking.

What browser and which operation system do you use ?

The white and blue blinking happens because the IR library uses a hardware timer that conflicts with analogWrite() on certain pins. Check that your LED/motor pins do not use the same timer as the IR receiver. Moving the LED to a different pin or avoiding analogWrite() on those pins should fix it.

I did that already as far as I know and the blinking stays
See the wokwi I posted earlier

@roelofw coukd you make a wokwi with the original code, and lock it (or stop playing with it) so it doesn't change under our feet?

I went "back in" to run this to ground and found the project basically gone.

But… the last thing I did was terribly alarming and suggests entirely new experiments, as well as invalidating many of the preliminary conclusions I had on the table.

I use different browsers on my machine, and also use several machines with different browsers.

I had very simple code mjsbehaving nicely (!) and for no particular reason moved it to another browser and… the LED which was a pulsating mess became solid bright white.

I'll do it again carefully and may contribute to the issue on github. I fear, however, that if someone can say it is broken in such-and-such a way on Browser X version Y, it will just be true, not turn into an action item for wokwi - faithful replication of the appearance of LEDs is tricky in simulation, for reasons; it's just a fact of life, a known feature.

I try to remember to tell ppl not to make too much of how LEDs look and work in the sim… real life may be different and any serious project where care about exactly what things look like must include real life tests with the actual LEDs and the current you plan on using deployed in the same mechanical circumstances.

a7

I rewrote the code with wokwi and the IR library and relevant pins.

Running this in Safari on a Mac, the colors seems largely OK - no blinking or whatever.

click to see the code
#include <IRremote.hpp>

const byte irReceivePin = 2;

const byte rPin = 9;
const byte gPin = 6;
const byte bPin = 5;

byte r, g, b;

void handleCommand() {
  if (IrReceiver.decode()) {
    switch (IrReceiver.decodedIRData.command) {
      case 162: r = 255; g = 105; b = 180; Serial.println("HOT PINK");      break; // POWER
      case 226: r = 0;   g = 128; b = 128; Serial.println("TEAL");          break; // MENU
      case 34:  r = 210; g = 105; b = 30;  Serial.println("CHOCOLATE");     break; // TEST
      case 2:   r = 255; g = 192; b = 203; Serial.println("PINK");          break; // PLUS
      case 194: r = 128; g = 0;   b = 128; Serial.println("PURPLE");        break; // BACK
      case 224: r = 255; g = 140; b = 0;   Serial.println("DARK ORANGE");   break; // PREV.
      case 168: r = 64;  g = 224; b = 208; Serial.println("TURQUOISE");     break; // PLAY
      case 144: r = 0;   g = 255; b = 127; Serial.println("SPRING GREEN");  break; // NEXT
      case 152: r = 255; g = 215; b = 0;   Serial.println("GOLD");          break; // MINUS
      case 176: r = 128; g = 128; b = 0;   Serial.println("OLIVE");         break; // key: C
      case 104: r = 0;   g = 0;   b = 0;   Serial.println("BLACK");         break; // 0
      case 48:  r = 255; g = 0;   b = 0;   Serial.println("RED");           break; // 1
      case 24:  r = 255; g = 127; b = 0;   Serial.println("ORANGE");        break; // 2
      case 122: r = 255; g = 255; b = 0;   Serial.println("YELLOW");        break; // 3
      case 16:  r = 0;   g = 255; b = 0;   Serial.println("GREEN");         break; // 4
      case 56:  r = 0;   g = 255; b = 255; Serial.println("CYAN");          break; // 5
      case 90:  r = 0;   g = 0;   b = 255; Serial.println("BLUE");          break; // 6
      case 66:  r = 75;  g = 0;   b = 130; Serial.println("INDIGO");        break; // 7
      case 74:  r = 148; g = 0;   b = 211; Serial.println("VIOLET");        break; // 8
      case 82:  r = 255; g = 255; b = 255; Serial.println("WHITE");         break; // 9

      default: break;
    }
    analogWrite(rPin, r);
    analogWrite(gPin, g);
    analogWrite(bPin, b);
    IrReceiver.resume();
  }
}

void setup() {
  pinMode(rPin, OUTPUT);
  pinMode(gPin, OUTPUT);
  pinMode(bPin, OUTPUT);

  Serial.begin(115200);
  IrReceiver.begin(irReceivePin);
  Serial.println(F("Ready"));
}

void loop() {
  handleCommand();
}

This code will not change because I use it on the bug report for wokwi.

But I will also lock it
And I agree that the IR stuff is not the cause because I made a minium sketch and still I see the "problem"

I can't try it in Safari because I can't move up to a later operating system to get a version that can run wokwi because I have so much software that would break if I did. Use a modern MacOS.

But I totally believe you. THX for going to the trouble. I think it is safe to assume the OP's code would not have the issue.

a7

I agree

Looks more and more a Wokwi problem then a problem of my code or wiring.

if I use the code of JML I see on some colors the blinking and one some colors no blinking.
And I do not have the knowlegde to see why

If this is for school or whatever, just use the printing as the evidence of your correct enhancements and refinements.

It might impress someone that you went to all this trouble.

Certainly you can continue development in the wokwi: just ignore the defective LED rendering.

Ironically, the wokwi may work way better than real life WRT the IR send and receive parts!

a7

Not sure if it's wokwi of if it's the browser...

have you tried with different browser ?

I tried my code with Chrome and Firefox (still on my Mac) and it works also flawlessly.

This is for a hobby

im way too old (59 ) to goto school.

I use Win11

and on both FireFox and on Chrome I see it.
With Chrome the blinkering is somewhat lesser then on Firefox.