Folks,
I am off on another project.
This needs a bit of maths behind it and although I think I have that part down, just putting it in a way Arduino understands is a bit difficult.
The sketch so far is WORK IN PROGRESS, so don't bombard me with "things are missing".
I am posting it here to get help on what I need to define/declare the variables as.
Now, I am trying to build structures into my code to maybe become a better programmer. Who knows?
Alas the code is called V1 - as it is version 1.
HSI is one of the sub-routines. Well, the only for now.
It should be self explanatory but just in case:
I have my little Accelerometer/GYRO/thingy sitting there and I turn it on.
Skipping "Zero-ing" it, apart from that in the code, it works out how to show attitude on an LED ring.
(From ADA fruit and each LED is addressable, controllable, etc.. LED NEOPIXEL)
Given that pitch is 0 to +90 or 0 to -90 I calculate how to "share" the leds to values.
There is a Zero Value Offset to tell the program where to show level.
The other offset is if LED #1 is not at the top. (Not used just yet)
Roll I shall hope is the same for values.
Excuse the BASIC way I have done it for now, but as the code said: BASIC PITCH.
There in lies the problem.
0 - 30 is one LED, 31 - 60 is another and 61 - 90 is the third.
Not really good.
Yes, INT() doesn't help.
So if I do (what I seem to remember as "single precision") I will then be able to work out if I need to show TWO LED's.
But what is that in Arduino lingo?
I "need" -90 to +90 range on these two axis.
Sure I can "cheat" and make it 0 - 180 and "-90" from what comes out.
What ever.....
Could someone please help me with this small sticking point?
Thanks in advance.
HSI.ZIP (885 Bytes)