[phpBB Debug] PHP Warning: in file /mnt/forum-shared/ext/sitesplat/BBCore/event/listener.php on line 70: in_array() expects parameter 2 to be array, boolean given
rotating... - SparkFun Electronics

SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion area - What have you built with your Micro View

Moderators: Help@GeekAmmo, marcus@geekammo

By tester919
Hi I am interested in trying to make an arrow and rotating that arrow around. However I don't know how to rotate an object. Any math gurus out there know how to rotate this arrow by various degrees.


I looked at the rotating cube and I assume there is a lot of math which I didn't pay much attention to in school.

Thanks in advance
By tester919
I'm trying to create a compass... so trying to integrate the HMC5883L is anyone has any tips for that as well.
By Help@GeekAmmo
Hi tester919,

If you are creating a compass, it will be easier to redraw the arrow using XOR mode. First XOR draw the arrow display the arrow, second XOR draw the same arrow at the same location make it disappear. Then from the sensor work out the angle of the next draw.

If you look at our source code for the round widget, this will actually do similar to what you wanted to do. Just hacked the code and make the arrow turn round.

If the above suggestion is not suitable, then you might want to make the arrow as a bitmap arrow image in a memory block, then perform matrix rotation formula, and finally transfer the rotated memory to MicroView's memory. This sounds so much harder and slow.

Hope this helps.