| Arduino Forum ::  Members :: S_Flex
 Show Posts Pages: 1 2 [3] 4
 31 Using Arduino / Programming Questions / Re: PWM - Peltier working code on: December 03, 2012, 06:28:42 am Thank you. I was thinking of a way to do it with math but I would always come up with a number that would force me to have to truncate a part of the number out. If I could use a regular expressions engine I could get it done in one line, but that just tells me I need to know C++ better.Thanks for the help.
 32 Using Arduino / Programming Questions / Re: PWM - Peltier working code on: December 01, 2012, 04:07:04 pm Quote from: PaulS on December 01, 2012, 10:12:29 amQuoteWhat would be the other way without using dtostrf()?You could split the float into two parts - the whole number and the fractional part. Then, multiply the fractional part by some amount and truncate. But why? There is nothing wrong with using dtostrf(). It is what you are doing AFTER calling dtostrf() that is the problem.It's easyer said than done that way. If you dont want to show me an example its makes me think you may not know how the 4 diget 7-segmant serial display works.
 33 Using Arduino / Programming Questions / Re: PWM - Peltier working code on: December 01, 2012, 09:39:24 am Quote from: PaulS on December 01, 2012, 09:27:54 amQuoteI'm kinda wondering if there is a another way to do it.Of course there is. Ditch the String class. The dtostrf() function puts the decimal point in a fixed position in tBuffer. You don't need the overhead and problems of the String class to move the characters to the right of the decimal point one place to the left.What would be the other way without using dtostrf()?
 34 Using Arduino / Programming Questions / Re: Parse temperature values to a webpage. on: December 01, 2012, 09:23:39 am Im just guessing but You may have to turn the float value from the sensor into a string.Code: char tBuffer[16]; String stringOne =  dtostrf(temp,8,2,tBuffer);Then use the value...