Help me to rotating this fan

@Gunner Hi gunner. can you help me to rotating this fan ?
1 2

I’m trying this cod but only showing one image. the V3 is image widget

  int pinValue = param.asInt();
  if (pinValue == 1)
    digitalWrite(Relay_9, LOW);
  else if (pinValue == 0)
    digitalWrite(Relay_9, HIGH);

I moved your issue into your own topic.

I only see two distinct images… and as far as the “ON” side, those two virtual prints would happen so fast that you would only see the image #2 anyhow.

If you want to have the “.gif” (pronounced giraffe :stuck_out_tongue_winking_eye: ) appearance, then you would need short timers alternating back and forth… much like my LED example…


thanks gunner. I tried your code. but it’s very fast flashing the fans and not rotating. I’m set the timer to 1000L

@Gunner gunner thanks. I’m change the time to 2000L its working.

1 Like

You need to adjust both timers to your own needs… but they also need to be in sequence with each other typically 2nd is 50% of 1st

FYI, I have not actually tried rapidly changing any images yet… but @Blynk_Coeur is an expert at it :smiley:


ah ah.
you are my teacher @Gunner.
don’t forget that.

1 Like

why not use the property “rotation” ? with only one image and one timer?

//Rotation property
Blynk.setProperty(V3, "rotation", 90); //0-360 degrees

//Scale property
Blynk.setProperty(V0, "scale", 30); //0-100%

//Opacity property
Blynk.setProperty(V0, "opacity", 50); //0-100%

@ErfanDL @Gunner :rofl::rofl::rofl:



Any chance you could share the code?



int Speed, R;

void setup()
timer.setInterval(100, Fan);

BLYNK_WRITE(V27) {//slider 0 to 4
  Speed = param.asInt();

void Fan() {
  R = R + (10*Speed);
  if (R >= 360) {
    R = 1;
 Blynk.setProperty(V0, "rotation", R); //0-360 degrees



Fantastic job @Blynk_Coeur :smiley:

1 Like

i know it isn’t perfect, I realized it in 5 mn.
mine has a variable speed, not yours.

1 Like

thank you @Gunner
this can be improved, but it depends on the speed of rotation and the gif image used.
@kotelmach has the solution:
do not use variable speed, it’s better.
what a pity !

1 Like

@Blynk_Coeur I really like your use of the rotation properties command… looks more than smooth enough , considering you have then converted it to a gif for forum presentation. I didn’t even think of those set property features… I would have been rapidly changing 2-3 images back and forth :stuck_out_tongue:

1 Like

How to set image name ? in this code the R is your image name ?

1 Like

no, R is the rotation degrees

1 Like

but where is image name ?

the name is not necessary

just virtual PIN is needed

Ahaa. OK but I want when the fan turning off the fan color changed to red color. is that possible with one image widget ?