MICS6814 LED control

Hi all,

I have a MICS6814, and I would like to turn off the LEDs, as it turns on as soon as my script performs:

MICS6814.read_all

I’ve read the documentation in the Pimoroni library, but I cannot seem to format the one line in Python to actually turn the bloomin thing off. I’ve tried:

MICS6814.set_pwm_period(4096)
MICS6814.set_brightness(0.0)

…and these error with:

set_pwm_period() missing 1 required positional argument: 'value'

I cannot seem to get the commands right and I’m losing my mind. I get that the LED could be useful, but why have it turn on by default?

Here’s my Python script in all it’s shabby glory… any advice gratefully received. The sensor is in my kitchen lighting it up like a f*cking christmas tree at the moment, and it’ll need to go if I can’t figure out how to turn it off.

#!/usr/bin/env python3

import time
from mics6814 import MICS6814
import logging
import paho.mqtt.client as mqtt #import the client1

gas = MICS6814()

MICS6814.set_pwm_period(4096) # this is the code that doesn’t work
MICS6814.set_brightness(0.0) # this is the code that doesn’t work

logging.basicConfig(
format=‘%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s’,
level=logging.INFO,
datefmt=‘%Y-%m-%d %H:%M:%S’)

try:
while True:
readings = gas.read_all()
logging.info(" | ".join(str(readings).splitlines()))
client = mqtt.Client(“zensor”) #create new instance
client.connect(“192.168.1.x”) #connect to broker
client.publish(“6814-data”,(str(readings)))#publish
time.sleep(10.0)
except KeyboardInterrupt:
pass

Does gas.set_led(0, 0, 0) not work?

1 Like

Thank you. So simple (a bit like me).

1 Like