Change NCIR 2 from C to F
-
How would I go about changing the NCIR 2 unit to read from celsius to fahrenheit? Any help would be great
-
Hello @reptilepvp
according to its datasheet the used sensor MLX90614 is Celsius only.
That said, there is a quite simple formula to convert Celsius into Fahrenheit. Have you tied that?
(0 °C × 9/5) + 32 = 32 °F
Thanks
Felix -
@felmue I apologize for sounding stupid & not doing my research. But could you possiblely show me where I need to put that in my code? I thought I put the formula in right. But I guess not .
i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
ncir2_0 = NCIR2Unit(i2c0, 0x5A)
ncir2_0.set_buzzer_control(0)
ncir2_0.set_rgb_led(0xcc33cc)
ncir2_0.set_emissivity_value(0.95)def loop():
global DopeMete, Battery, Temperature, label5, label0, line0, label1, line2, label2, line1, label3, label4, i2c0, ncir2_0
M5.update()
label2.setText(str("%.2f"%float((((ncir2_0.get_temperature_value) * 9) / 5 + 32))))
label3.setText(str(ncir2_0.get_emissivity_value))
label4.setText(str(ncir2_0.get_button_status))
label5.setText(str(Power.getBatteryLevel())) -
Hello @reptilepvp
just try something like below:
label2.setText(str(((ncir2_0.get_temperature_value) * 9) / 5 + 32))
Note: untested as I do not have the necessary hardware to verify.
Thanks
Felix