• Thanks for all the good advice.

    I think I need to lean some vector math!

    my next steps are:

    Use Vec3.js to calibrate my mag sensor and surroundings.

    by adding a hold down the button for 4 seconds to calibrate feature:

    To calibrate rotate the puck in all directions while sampling the mag data at a high rate, save the min and max value of each x,y,z axis.

    Press button to exit calibrate

    Take the average of the min/max for x,y,z and store these as JSON to a file in flash mem.

    Sample at a lower rate and subtract the average x,y,z from each reading

    use vector maths to calculate which way up the puck is and any clockwise or anticlockwise rotation steps.

    Then I need to work out how to send HID command via BT

    I will post an update as soon as I have made progress or if I have more problems. With some debug output this time.


Avatar for user101436 @user101436 started