Shop OBEX P1 Docs P2 Docs Learn Events
Can anyone tell me what this code does? — Parallax Forums

Can anyone tell me what this code does?

Asobu04Asobu04 Posts: 1
edited 2009-04-13 01:39 in BASIC Stamp
I was wondering if someone could tell me what this code does.

It starts off with

READ CompassLowVal, index
' Load current and previous table values.
READ CompassCal + index, table(current)
READ (CompassCal + (index - 1 & $F)), table(previous)

I'm assuming that it is loading the first value of CompassCal into table(curent) and the last value of CompassCal into table(previous). Is this right?


angleOffset = angleOffset * 16
angle = (angleOffset / span) + ((angleOffset // span) / (span / 2))
angle = ((index - 1 & $F) * 16) + angle
angle = angle & $ff

When I look at the statements (index-1 & $F) or (angle & $ff) it would seem that you would just get back your index-1 or angle respectively. Thanks!

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-04-13 01:39
    Where did you get the code and was there any other info at the same place?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.