I put together a simple color-coded compass using the Puck's magnetometer. It's admittedly less robust and doesn't contain much sophisticated math, but it more or less matches readings from my smartphone's compass app. See attached file.
Color Codes
Red, Green, Blue Sequential Flash = North (330 to 30 deg)
Solid Red = East (60 to 120 deg)
Solid Green = South (150 to 210 deg)
Solid Blue = West (240 to 300 deg)
Possible enhancements:
Turn compass on/off via button click
Fade color in/out between cardinal directions. For example, when pointing to 135 deg, both Red and Green LEDs should be lit. As directions moves more toward 90 degrees, Red gets stronger and Green gets weaker. Or at least something similar to indicate intermediate directions.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I put together a simple color-coded compass using the Puck's magnetometer. It's admittedly less robust and doesn't contain much sophisticated math, but it more or less matches readings from my smartphone's compass app. See attached file.
Color Codes
Red, Green, Blue Sequential Flash = North (330 to 30 deg)
Solid Red = East (60 to 120 deg)
Solid Green = South (150 to 210 deg)
Solid Blue = West (240 to 300 deg)
Possible enhancements:
See this thread for more sophistication: http://forum.espruino.com/conversations/297915/
1 Attachment