HMC5883L Compass Module with Parallax Serial LCD
MakerDino
Posts: 19
I've completed a new project and video with the Compass Module connected to the BOE. Check out the video and see what you think of the way I modded the demo code to work with the LCD. [video=youtube_share;3joOzwHa-Uw]
The code is here: http://hackaweek.com/hacks/?attachment_id=1004
I invite any and all feedback on how this code can be cleaned up to work better. I'm a code hacker, not a real programmer.
Keep On Hackin!
The code is here: http://hackaweek.com/hacks/?attachment_id=1004
I invite any and all feedback on how this code can be cleaned up to work better. I'm a code hacker, not a real programmer.
Keep On Hackin!
Comments
Headinglcd:
lcd.str( string( 17, "Heading:", 13 ) ) would do the whole job
aziadjust & Heading:
Instead of having 4 byte variables NW,NE,SE,SW and t1 I'd use one direction byte with bits N, E, S, W. Then you can use a case statement in Heading
case direction
N:
backspace( 5 )
lcd.str( @NORTH )
N | W:
lcd.tx( 32 )
lcd.str( @N )
....
W:
...
Header:
As you can already see in the case statement, I'd write a function for lcd.tx( 8 ) ....
Same thing for the code in NE,SE,SW and NW
PUB dirOut(t, d1, d2)
lcd.tx( 32 )
lcd.str( d1 )
lcd.dec( t )
lcd.str( d2 )
lcd.tx(32)
lcd.tx(32)
In the case statement you can call:
case direction:
N | E:
dirOut( aziadjust, @N, @E )
S | E:
dirOut(||(aziadjust-180), @S, @E)
S | W:
....
GetRaw:
What this is good for
x := x
z := z
y := y
I can't tell ;o)