puckrotate code - for a puck lying flat #3929
Replies: 1 comment
-
Posted at 2022-01-18 by Mi For relative rotation you need to use gyro. Posted at 2022-01-18 by kab great pointer - thanks. Posted at 2022-01-19 by @gfwilliams As mentioned, gyro would work well. However compass could be ok as long as there are no magnets floating around (or you could ensure you mount the Puck with a magnet nearby so that you're then measuring the rotation relative to that magnet). You just need to rotate the Puck a full 360 degrees when you start up so you can calibrate the max/minimum values. This is some old code I had kicking around that that works out an angle then lights up accordingly. Realistically to work nicely it needs a magnet nearby though
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2022-01-17 by kab
I am working on my next project. I'd like to change volume via BLE by using the Puck lying flat on a table and rotating it left or right to send a BLE advertisement volume up (right) or volume down (left). So, rotate puck right - send signal "volumeup". rotate Puck left send signal "volume down".
I don't want (I think) to use the hid keyboard/mouse etc options because I want just a passive signal being sent out to Espruino Hub and "translate" the advertisement via MQTT. I don't want the Puck to have to be connected.
I have tried the various postings for compasses, mag/accel/ averaging but really had no luck. Must admit the maths go a bit over my head. I think what I should be watching is x? going positive or negative but haven't found that to be true in my tests.
The I found the puckrotate posted code on the apploader(?) which works, if the button is vertical. I have tried to figure out how to change it such that it works with the button flat - with no luck.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions