NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Reading Resistance

August 28, 2010
by LindaEC
LindaEC's Avatar

Hello, I am using the tempsensor code, but instead of the senor I have added a resistor which is a 1k(R1) to 5v and a 10k(R2) to gnd, I am reading about 4.56v.What I want to do is insert this formula which will give me the resistance of R2. R2=R1/VIN/VOUT-1. I dont know where to insert it and what else I need to include to make this dispaly on the LCD.

August 28, 2010
by LindaEC
LindaEC's Avatar

I got it!!!!

October 04, 2010
by Zachariah
Zachariah's Avatar

I would like to know how to do this as well. I am really new to using C so if you could post the code that you used for this I would be quite grateful.

October 17, 2010
by LindaEC
LindaEC's Avatar

here you go // write message to LCD lcd_home(); lcd_write_string(PSTR("ADC: ")); lcd_write_int16(last_sample); lcd_write_string(PSTR(" of 1024 ")); lcd_line_two(); fprintf_P(&lcd_stream, PSTR("Res: %.2f"),1000/(5/temp_avg-1)); lcd_write_data(0xdf); lcd_write_string(PSTR("OHM ")); lcd_line_three(); lcd_write_string(PSTR(" ")); // write message to serial port printf_P(PSTR("%.2f degrees Frn"), temp_avg);

Post a Reply

Please log in to post a reply.

Did you know that you can input numbers in binary via a DIP switch, and output them to the LCD? Learn more...