By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

How do i make the Thermometer capture from temperture

P: 32
Hi guys

I have got the temperature working which capture from the board and now i want to make thermometer capture from the temperature.

How do i do it?

any idea how and can you provide me a code aswel thanks
PLEASE HELP
from

bhav
Mar 19 '07 #1
Share this Question
Share on Google+
12 Replies


DeMan
100+
P: 1,806
Please post more detail. It is not clear from the post, what you are trying to acheive and where you need help.

You are also unlikely to get full code, although we are more than happy to work you through any difficulties you might find....
Mar 19 '07 #2

P: 32
Please post more detail. It is not clear from the post, what you are trying to acheive and where you need help.

You are also unlikely to get full code, although we are more than happy to work you through any difficulties you might find....
well basically,
my coding is too big to send it here..

well what i done.. is that.. i have managed to get the temperature working which capture from the can motor board. and now i want to make a thermometer capture from the temperature showing excatly % as the temperature (showing graphically .. you know like when you have thermomenter in ur mouth checking ur pressure like in hospital showing the red colour rising LOL) like that

i dont know if i have explain it clearly
Mar 19 '07 #3

DeMan
100+
P: 1,806
So you have a method qhich gets a temperature (since it works, we don't need to know from where) and you want a graphical bar to be displayed to show how high this temperature is. Is that roughly correct?
Have you ever programmed GUI projects before?
Mar 19 '07 #4

P: 32
So you have a method qhich gets a temperature (since it works, we don't need to know from where) and you want a graphical bar to be displayed to show how high this temperature is. Is that roughly correct?
Have you ever programmed GUI projects before?
hi..
yes that right i want a graphical bar to be displayed to show how high this temperature is. e.g. if the temperature is 23% then the graphical bar should show 23%

yes i have done.. gui project.. in c programming.

like in my programming for the temperature buffer to capture from the board
-------------------------------------------------------------------------------------------------------------
unsigned char temperature_buff[120];

//display temp in % in temperature box
sprintf(temperature_buff,"%2.2d",data[2]);
moveto(521,90);
outtext(temperature_buff);
//display % next to temperature buffer
moveto(545,90);
outtext("%");

---------------------------------------------------------------------------------------------------------------

so any1 knows how i can make the graphical bar please help me
thanks
Mar 20 '07 #5

Expert 100+
P: 1,510
I assume your PC is connected to the canbus network and you are collecting data and wish to display it graphically. What compiler/operating system are you using? Many compilers come with a graphics library which you can use to draw a bargraph or you could use something like the GNU plotutils
http://www.gnu.org/software/plotutils/
Mar 20 '07 #6

P: 32
I assume your PC is connected to the canbus network and you are collecting data and wish to display it graphically. What compiler/operating system are you using? Many compilers come with a graphics library which you can use to draw a bargraph or you could use something like the GNU plotutils
http://www.gnu.org/software/plotutils/
hi
yes you right im using the pc which is connected to canbus board network and collecting data from the board to my c progreamming. and now i want to collect the temperature number into bar graphs
i have managed to make a box just need to capture temp into bar graphic

any idea how i can do it..
Mar 20 '07 #7

P: 32
any1 can help me please
thanks
Mar 20 '07 #8

Expert 100+
P: 1,510
any1 can help me please
thanks
what compiler are you using
Mar 20 '07 #9

P: 32
what compiler are you using
well im using old program turbo c version 2
Mar 20 '07 #10

DeMan
100+
P: 1,806
You have made a box (which I assume represents 100%), so you could add a box (filled in a different colour), with one dimension scaled down to 23% (or x%), as one solution. I'm pretty sure that because GUI programming tends to be event driven, updating this picture on a regular basis is no big deal.
Mar 20 '07 #11

Expert 100+
P: 1,510
well im using old program turbo c version 2
turbo c V2.0 has the graphics library <graphics.h> whih contains functions to draw rectangles and fill areas- see the help system.

try this program which draws a rectange and fills it
Expand|Select|Wrap|Line Numbers
  1.  #include <graphics.h>
  2.  #include <stdlib.h>
  3.  #include <stdio.h>
  4.  #include <conio.h>
  5.  
  6.  int main(void)
  7.  {
  8.     /* request auto detection */
  9.     int gdriver = DETECT, gmode, errorcode;
  10.     int maxx, maxy;
  11.  
  12.     /* initialize graphics, local variables
  13. */
  14.     initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
  15.  
  16.     /* read result of initialization */
  17.     errorcode = graphresult();
  18.     if (errorcode != grOk)
  19.     /* an error occurred */
  20.     {
  21.        printf("Graphics error: %s\n", grapherrormsg(errorcode));
  22.        printf("Press any key to halt:");
  23.        getch();
  24.        exit(1);
  25.        /* terminate with an error code */
  26.     }
  27.  
  28.     maxx = getmaxx();
  29.     maxy = getmaxy();
  30.  
  31.     /* select drawing color */
  32.     setcolor(getmaxcolor());
  33.  
  34.     /* select fill color */
  35.     setfillstyle(SOLID_FILL, getmaxcolor());
  36.  
  37.     /* draw a border around the screen */
  38.     rectangle(20, 20, 100, 100);
  39.  
  40.  
  41.     /* fill in bounded region */
  42.     floodfill(50, 50, getmaxcolor());
  43.  
  44.     /* clean up */
  45.     getch();
  46.     closegraph();
  47.     return 0;
  48.  }
Mar 21 '07 #12

P: 32
turbo c V2.0 has the graphics library <graphics.h> whih contains functions to draw rectangles and fill areas- see the help system.

try this program which draws a rectange and fills it
Expand|Select|Wrap|Line Numbers
  1.  #include <graphics.h>
  2.  #include <stdlib.h>
  3.  #include <stdio.h>
  4.  #include <conio.h>
  5.  
  6.  int main(void)
  7.  {
  8.     /* request auto detection */
  9.     int gdriver = DETECT, gmode, errorcode;
  10.     int maxx, maxy;
  11.  
  12.     /* initialize graphics, local variables
  13. */
  14.     initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
  15.  
  16.     /* read result of initialization */
  17.     errorcode = graphresult();
  18.     if (errorcode != grOk)
  19.     /* an error occurred */
  20.     {
  21.        printf("Graphics error: %s\n", grapherrormsg(errorcode));
  22.        printf("Press any key to halt:");
  23.        getch();
  24.        exit(1);
  25.        /* terminate with an error code */
  26.     }
  27.  
  28.     maxx = getmaxx();
  29.     maxy = getmaxy();
  30.  
  31.     /* select drawing color */
  32.     setcolor(getmaxcolor());
  33.  
  34.     /* select fill color */
  35.     setfillstyle(SOLID_FILL, getmaxcolor());
  36.  
  37.     /* draw a border around the screen */
  38.     rectangle(20, 20, 100, 100);
  39.  
  40.  
  41.     /* fill in bounded region */
  42.     floodfill(50, 50, getmaxcolor());
  43.  
  44.     /* clean up */
  45.     getch();
  46.     closegraph();
  47.     return 0;
  48.  }
hey mate.. thanks for the codes.. but how do i capture the temperature buffer to get the themometer graphics up and down e.g. if the temp is 24 then the themometer shud b 24 how can i do that
Mar 21 '07 #13

Post your reply

Sign in to post your reply or Sign up for a free account.