Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Math — Parallax Forums

Propeller Math

MD2010MD2010 Posts: 11
edited 2010-11-12 10:36 in Propeller 1
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.

Comments

Sign In or Register to comment.