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

BLYNK_WRITE(V9)
{
  int pinValue = param.asInt();
  if (pinValue == 1)
  {
    digitalWrite(Relay_9, LOW);
    Blynk.virtualWrite(V3,1);
    Blynk.virtualWrite(V3,2);
  }
  else if (pinValue == 0)
  {
    digitalWrite(Relay_9, HIGH);
    Blynk.virtualWrite(V3,3);
  }
}

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…

2 Likes

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:

2 Likes

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

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%
4 Likes

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

Video_00401

5 Likes

Any chance you could share the code?

2 Likes

@Toro_Blanco

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
5 Likes

Video_00402

3 Likes

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.
:joy::joy::joy::joy:

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 !
:joy::joy::joy::joy:

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 ?
thanks

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 ?