Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error starting test.py #3

Open
jbelusic opened this issue Jul 15, 2021 · 0 comments
Open

Error starting test.py #3

jbelusic opened this issue Jul 15, 2021 · 0 comments

Comments

@jbelusic
Copy link

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant