CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

speedometer with graphic lcd

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

speedometer with graphic lcd
PostPosted: Tue Feb 09, 2021 11:16 am     Reply with quote

Hello to everyone
I want to make a speedometer with graphic lcd. As long as the button is pressed, the pointer will move within half an arc. Like the system in vehicles. I wrote the arc function to the graphics driver. It works. But how can I move the pointer at an angle? What is the formula for this job? Do I do it using glcd_line or glcd_pixel? How do you think.
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 09, 2021 11:33 am     Reply with quote

hmm, the last intense graphics I did was 3+ decades ago, on a Model III computer but...
Since you cut the code for the 'arm' of the pointer, you know where the moving 'end' of the arm will be. The 'pointer' is probably 2-3 pixels next to the end of the arm, so you could just turn on those 'nearby' pixels.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Feb 09, 2021 11:34 am     Reply with quote

You would draw a line from the centre to the angle required on the curve
forming the outside of the shape. Honestly think in terms of using a look-
up table for this. So precalculate the X and Y coordinates of the end
points, perhaps in a spreadsheet on a PC, and store the coordinates in
an array. For something like 100 RPM values, this will be smaller and
enormously faster than trying to do the calculation in the PIC.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group