Closed PVorster11 closed 7 years ago
Yes - should be pretty easy to do. I'll see if I can knock something together tonight.
Thank you!!!
Ok. Let's try this...
Create a new folder in "screens" called "temperature". Copy this zip file into that folder and extract it.
Run the program and hope it works!
Hello!
I get an error message saying the temperature screen has unmet dependencies: temperature: Adafruit_MAX31855
I take it this is from the .json file.
Strange. I would have expected that line to work if your temperature code works.
Change conf.json to this:
{
"screen": "TemperatureScreen",
"kv": "temperature.kv",
"dependencies": [],
"enabled": true
}
I tried that and get:
Errors were encountered trying to create the following screens: temperature: ValueError('A different mode has already been set".)
Sounds like Adafruit's code is conflicting with the Energenie code. Can you just try disabling the energenie screen for now.
If that works we can fix the energenie one!
Can it be this include which is in my original code but not the new code?
import Adafruit_GPIO.SPI as SPI
With the Energenie screen disabled, I still get the "unmet dependencies" error
No, won't be that line - your code doesn't use it directly.
Which dependencies are unmet?
temperature: Adafruit_MAX31855
Sounds like you haven't updated conf.json
That line can only appear if "Adafruit_MAX31855" is listed in dependencies.
You'll need to restart the code after changing it.
You're a genius!!! It works now.
Now just figuring out why the Energenie screen doesn't work
OK - so we just need to fix Energenie (don't worry, it's easy)
In the energenie_rpigpio.py code, change the pin numbering lines to this:
BIT1 = 17
BIT2 = 22
BIT3 = 23
BIT4 = 27
ON_OFF_KEY = 24
ENABLE = 25
and change this line:
GPIO.setmode(GPIO.BOARD)
to
GPIO.setmode(GPIO.BCM)
WORKS 100%, Thank you!!!!!! What was the issue?
The RPi.GPIO module only lets you use one pin numbering layout (either board numbering or Broadcom numbering).
The temperature module forces the Broadcom numbering but my Energenie code was using board numbering. I've changed it to use the Broadcom numbering.
You can see the different numbering layouts here.
Incidentally, I think this is why the pigpio code didn't work, I think I got the numbers wrong!!
Thank you once again, really appreciate all of your help. THANK YOU!!
Hi elParaguayo,
I was wondering if you could suggest a simple solution to get the following script to display in a kivy label.
Once again, I can't thank you enough for all of your help.
Code:
import time import Adafruit_GPIO.SPI as SPI import Adafruit_MAX31855.MAX31855 as MAX31855
Define a function to convert celsius to fahrenheit.
def c_to_f(c): return c * 9.0 / 5.0 + 32.0
Raspberry Pi software SPI configuration.
CLK_1 = 13 CS_1 = 6 DO_1 = 5 sensor1 = MAX31855.MAX31855(CLK_1, CS_1, DO_1)
CLK_2 = 16 CS_2 = 26 DO_2 = 19 sensor2 = MAX31855.MAX31855(CLK_2, CS_2, DO_2)
print('Press Ctrl-C to quit.') while True: temp1 = sensor1.readTempC() temp2 = sensor2.readTempC() internal1 = sensor1.readInternalC() internal2 = sensor2.readInternalC() print('Thermocouple1 Temperature: {0:0.3F}C / {1:0.3F}F'.format(temp1, c_to_f(temp1)))
print(' Internal1 Temperature: {0:0.3F}C / {1:0.3F}F'.format(internal1, c_to_f(internal1)))