Go Down

Topic: What's wrong with this code? (Read 396 times) previous topic - next topic

KenshinPT

Mar 23, 2013, 09:46 pm Last Edit: Mar 23, 2013, 09:53 pm by KenshinPT Reason: 1
Hey mates,

I don't have any clue why this code does not work right.

If "minute" is 36, why "brightnessFactor" is "1"?

By the way... no matter what the minute is, brightnessFactor is always "1"? brightnessFactor should be 0.82 when "minute" is 36.

Pardon my french, but WTF?!

:) Thanks mates!


Delta_G

You've got a line there that says brightnessFactor = a whole bunch of integer math.  Integer math is only going to give inter gets, it will never give you 0.82 or any other decimal number.

Make those constants floats like 1.0 and 2.0 instead of just 1 and 2 and see what happens.
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

KenshinPT


You've got a line there that says brightnessFactor = a whole bunch of integer math.  Integer math is only going to give inter gets, it will never give you 0.82 or any other decimal number.

Make those constants floats like 1.0 and 2.0 instead of just 1 and 2 and see what happens.


Thank you so much mate :) Problem solved.

This is why I hate coding! ^^!


AWOL

Please read the sticky threads.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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!

Arduino
via Egeo 16
Torino, 10131
Italy