Can anyone help me with my simple project? I'm very new on the OpenMV M7. I just need to move a mini servo depending on the text read on the QR Code.
I've used the sample QR Code and the text on the QR is printed on the "payload". How can i extract the payload and use it as a variable to move the servo by a certain degrees?
Code: Select all
import sensor, image, time from pyb import Servo sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... clock = time.clock() while(True): clock.tick() img = sensor.snapshot() img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens. for code in img.find_qrcodes(): img.draw_rectangle(code.rect(), color = (255, 0, 0)) print(code) if (code == "LEFT"): s1 = pyb.Servo(1) s1.angle(45)