Go Down

Topic: Reference Material Needs Update (Read 2327 times) previous topic - next topic


I don't know how this newbie bug made it through - I swear I tested this code:

Anyway - on the "for" reference page.

void loop()
   int x = 1;
   for (int i = 0; i > -1; i = i + x){
      analogWrite(PWMpin, i);
      if (i = 255) x = -1;             // switch direction at peak

Change the biggest newbie mistake of

     if (i = 255) x = -1;             // switch direction at peak

to       if (i == 255) x = -1;             // switch direction at peak

Maybe it's proof no one reads the docs anyway



Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131