MD2010

11-12-2010, 06:20 PM

I am trying to do a simple math calculation and turn LED’s on.

outa[8..15] := 0 ‘will not turn any on

outa[8..15] := 255 ‘will turn all on

My formula is var2 := (var1 - 800)/4.70588.

outa[8..15] := var2

I understand that var1 needs to be a long and Var2 needs to be an int, but I don’t know how to do that.

The variable input, var1, will be between 800 and 2000, so the results, var2, will be between 0 and 255.

outa[8..15] := 0 ‘will not turn any on

outa[8..15] := 255 ‘will turn all on

My formula is var2 := (var1 - 800)/4.70588.

outa[8..15] := var2

I understand that var1 needs to be a long and Var2 needs to be an int, but I don’t know how to do that.

The variable input, var1, will be between 800 and 2000, so the results, var2, will be between 0 and 255.