micropython-MQ
micropython-MQ copied to clipboard
Error starting test.py
I found a error starting test.py script from this repo because this script have to run MQ2.py (this is sensor I use in my case) and BaseMQ.py from same root folder. I use ESP8266 Lolin microcontroller with Micropython framework. test.py have to be modify to work as this:
Test for MQ-series drivers
from MQ2 import MQ2 import utime
class App: def init(self, pin = 0): self.sensor = MQ2(pinData = pin, baseVoltage = 3.3)
def Run(self):
print("Calibrating")
self.sensor.calibrate()
print("Calibration completed")
print("Base resistance:{0}".format(self.sensor._ro))
while True:
print("Smoke: {0}".format(self.sensor.readSmoke()))
print("LPG: {0}".format(self.sensor.readLPG()))
print("Methane: {0}".format(self.sensor.readMethane()))
print("Hydrogen: {0}".format(self.sensor.readHydrogen()))
utime.sleep(5)
App().Run()