Pinado
Posts: 16
Joined: Mon Jul 15, 2019 8:51 pm
Location: Colorado, USA

HAT Code Help

Wed Aug 07, 2019 3:09 pm

Starting again so,
I still cant get the code to work. Here is what I have

Code: Select all

from sense_hat import SenseHat
from datetime import datetime
sense = SenseHat()
def get_sense_data():
    sense_data = []
    return sense_data
datetime.now()
while True:
    print(get_sense_data())
dtoverlay=rpi-sense
I dont know if this helps but the HAT I am trying to attatch is the MCC-118 from Measurement Computing Corporation. When I try to run the code I get these error messages:
Traceback (most recent call last):
File "/home/pi/Desktop/DAQ HAT.py", line 3, in <module>
sense = SenseHat()
File "/usr/lib/python3/dist-packages/sense_hat/sense_hat.py", line 39, in __init__
raise OSError('Cannot detect %s device' % self.SENSE_HAT_FB_NAME)
OSError: Cannot detect RPi-Sense FB device.

I read through a forum that I was directed to but since I dont have much coding experience, it was hard for me to get anything from it. The forum is here: https://www.raspberrypi.org/forums/view ... p?t=173113

Any help is appreciated. Thanks!

Pinado
Posts: 16
Joined: Mon Jul 15, 2019 8:51 pm
Location: Colorado, USA

Re: HAT Code Help

Wed Aug 07, 2019 3:42 pm

Also, can anyone tell me what the error in line 3 of the code is? The sense = SenseHat()

Thanks!

trejan
Posts: 3017
Joined: Tue Jul 02, 2019 2:28 pm

Re: HAT Code Help

Wed Aug 07, 2019 4:14 pm

You've got a MCC 118 DAQ HAT attached but your code is for the Sense HAT and you've got the dtoverlay line for /boot/config.txt in there as well. It is complaining it can't find the Sense HAT which isn't too surprising if you do have a MCC 118 attached. Go look at the software tab on the MCC 118 page for the correct code. You'll have to look the examples and follow the installation guide there.

User avatar
B.Goode
Posts: 10727
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: HAT Code Help

Wed Aug 07, 2019 4:16 pm

Pinado wrote:
Wed Aug 07, 2019 3:42 pm
Also, can anyone tell me what the error in line 3 of the code is? The sense = SenseHat()

Thanks!

My guess would be that the Sense Hat library module is trying to establish contact with an official Raspberry Pi Sense HAT hardware add-on. https://www.raspberrypi.org/products/sense-hat/

But it seems that may not be the external hardware that you have connected to your RPi?


(Apparently the same conclusion reached by @trejan as I was typing this... )

Pinado
Posts: 16
Joined: Mon Jul 15, 2019 8:51 pm
Location: Colorado, USA

Re: HAT Code Help

Wed Aug 07, 2019 4:21 pm

Thank you. I never said I was good at this :roll:

Return to “General programming discussion”