chipKIT® Development Platform

Inspired by Arduino™

Display values on Basic I/O Shield OLED

Created Mon, 19 Sep 2011 12:48:38 +0000 by walnuts


walnuts

Mon, 19 Sep 2011 12:48:38 +0000

This is the first time I've dabbled in programming, so I may be over looking something very simple, but please, any help or pointers will be greatly appreciated.

I am trying output the temperature values from the I2C Temp Sensor to the OLED screen on the Basic I/O Shield. I'm running all of this from a Max32 board. So far, through all of the ideas I've been able to come up with from researching/trial&error I've only been able to get the screen to tell me that my basement is apprximately "q" degrees Farenheit and goes up to about "s" or "t" when I hold my finger on the sensor. The only time I was able to get it to display a number it said it was 2202 degrees Farenheit... hoping that's not correct.

Can some one help me display the value being pulled from the Temp Sensor and display it on the OLED please? Thanks.

~Rich


jknickelbein

Wed, 21 Sep 2011 07:51:05 +0000

Hi Rich

I have just started playing with it as well. I added some stuff like logging the temps to EEPROM, but this is what I did. I merged the OLed library with the Temp library to get the attached sketch.

I found that the string library doesn't handle floats for the IO Shield, so I did a bit of work around to create a string that included the fractional part. If you want the temperature in Farenheit, call the convCtoF() function.

I hope this helps.

Jeff


walnuts

Wed, 21 Sep 2011 11:08:13 +0000

Thanks, Jeff. I only had a couple of minutes to look at your code this morning but I think I understand how you manipulated the float values to get them printed. I'll have to sift through it a bit more after work and hopefully I can get my own sketch made up. :)

Rich


avenue33

Wed, 21 Sep 2011 11:52:17 +0000

... how you manipulated the float values to get them printed.

Please find a :arrow: float to string converter that works fine for me.


walnuts

Wed, 21 Sep 2011 11:58:01 +0000

Even better :) Thanks! It'd be a lot easier for me if I had ANY background in programming at all. As it is, its not just that I don't know how to do things, I don't know what to look for sometimes!

Thank goodness I work with several electrical engineers that are familiar with Arduino code.

Rich


jknickelbein

Fri, 23 Sep 2011 14:06:33 +0000

It would be nice if the ftoa() function was part of the default libraries like stdlib.h.

Jeff