I recently completed the AQI in the Learn section, https://learn.adafruit.com/aqi-case and was wanting to change the output from Fahrenheit to Celsius. I tried to change the code around to calculate the reverse of the supplied code. Also, the Faherenheit to Celsius symbol on the screen.
Thanks in advance,
Scott
AQI Celsius Output
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: AQI Celsius Output
This is the part that converts the temperature:
And this is the part that uses the function:
Just temp = scd4x.temperature should work.
Code: Select all
def c_to_f(temp_data):
temperature_celsius = temp_data
temperature_fahrenheit = temperature_celsius * 9 / 5 + 32
return temperature_fahrenheit
Code: Select all
sensor_check:
co2 = scd4x.CO2
temp = c_to_f(scd4x.temperature)
humidity = scd4x.relative_humidity
- Powderjockey
- Posts: 189
- Joined: Fri Mar 31, 2017 10:14 pm
Re: AQI Celsius Output
Thanks @Franklin97355. I'll give it ago.
- Powderjockey
- Posts: 189
- Joined: Fri Mar 31, 2017 10:14 pm
Re: AQI Celsius Output
I commented out the "def c_to_f(temp_data):" section and then made "temp = scd4x.temperature" the line.
The temperature has changed, but I don't think it is correct. Showing 28 degrees in the house and that is out about 5. Also, the degree Farhenheit symbol is still on the screen. Line 78, temp_text = bitmap_label.Label(small_font, text="%d" % temp, x=130, y=107, color=0xFFFFFF)
pulls the symbol from somewhere.
Thanks
The temperature has changed, but I don't think it is correct. Showing 28 degrees in the house and that is out about 5. Also, the degree Farhenheit symbol is still on the screen. Line 78, temp_text = bitmap_label.Label(small_font, text="%d" % temp, x=130, y=107, color=0xFFFFFF)
pulls the symbol from somewhere.
Thanks
- Powderjockey
- Posts: 189
- Joined: Fri Mar 31, 2017 10:14 pm
Re: AQI Celsius Output
The image that ships with the program has the Farhenheit symbol aready imbedded on it, so the symbol will never change to Celsius.Powderjockey wrote: ↑Mon Jun 05, 2023 3:37 pm I commented out the "def c_to_f(temp_data):" section and then made "temp = scd4x.temperature" the line.
The temperature has changed, but I don't think it is correct. Showing 28 degrees in the house and that is out about 5. Also, the degree Farhenheit symbol is still on the screen. Line 78, temp_text = bitmap_label.Label(small_font, text="%d" % temp, x=130, y=107, color=0xFFFFFF)
pulls the symbol from somewhere.
Thanks
Thoughts for an update?
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: AQI Celsius Output
There is a file called airBG.bmp that you can edit. I did but I can't include it in the forum ( it won't let me)I renamed it with an extension .txt you can see if renaming it .bmp will work. Let me know.
- Powderjockey
- Posts: 189
- Joined: Fri Mar 31, 2017 10:14 pm
Re: AQI Celsius Output
FRANKLIN97355, that worked. What did you use to edit it?
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: AQI Celsius Output
I used GIMP on a Linux system but it will work with Windows and Mac
Please be positive and constructive with your questions and comments.