Not specifically Espruino but hoped to pick the forums brains.
I'm trying to use browser deviceorientation API to control an RC car running Espruino.
I was using the beta and gamma change events so the steering would work with tilting the phone left and right of the horizontal, which I thought was fine, but on handing my phone to my youngest - he rotated it and starting to use the phone like a steering wheel. He was disappointed.
A UI lesson learned I'm now trying to use the alpha change event, which is basically using the phones compass I think?
So my problem/question. My problem is that steering needs to be relative to the position the phone starts in say facing 180 degrees. I can detect decrements and increments relative to that, no problem, to provide left and right events, but what if the user changes their orientation - as they might if following an RC car? The steering will start to go off. Same result if the phone starts from a angled position, my first bearing will be off so the steering will not be natural
I hope that makes sense. Has anyone done this? Is there a better approach?
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.
Not specifically Espruino but hoped to pick the forums brains.
I'm trying to use browser deviceorientation API to control an RC car running Espruino.
I was using the beta and gamma change events so the steering would work with tilting the phone left and right of the horizontal, which I thought was fine, but on handing my phone to my youngest - he rotated it and starting to use the phone like a steering wheel. He was disappointed.
A UI lesson learned I'm now trying to use the alpha change event, which is basically using the phones compass I think?
So my problem/question. My problem is that steering needs to be relative to the position the phone starts in say facing 180 degrees. I can detect decrements and increments relative to that, no problem, to provide left and right events, but what if the user changes their orientation - as they might if following an RC car? The steering will start to go off. Same result if the phone starts from a angled position, my first bearing will be off so the steering will not be natural
I hope that makes sense. Has anyone done this? Is there a better approach?