SparkFun Forums 

Where electronics enthusiasts find answers.

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

Moderators: marcus@geekammo, Help@GeekAmmo

By tester919
#180389
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.

uView.line(26,19,26,45);
uView.line(26,45,40,45);
uView.line(40,19,40,46);
uView.line(18,18,27,18);
uView.line(40,18,50,18);
uView.line(17,18,33,2);
uView.line(49,18,33,2);

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
#180391
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
#180418
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.

Cheers
JP