-
Couldn't load subscription status.
- Fork 45
Open
Description
When I'm writing data to the Z axis (I presume it will be the same also on X and Y), the axis is flickering to zero, is there any way I can make a default value (when it is getting no data) or something?
This is my code:
##!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor
from pybricks.parameters import Port
import pyautogui
import pyvjoy as vj
class Clutch:
def __init__(self, sensetivity):
#self.ev3 = EV3Brick()
#self.clutchMotor = Motor(Port.C)
self.sensetivity = sensetivity
self.writeVjoy()
def writeVjoy(self):
j = vj.VJoyDevice(1)
while True:
try:
#x = self.clutchMotor.angle
x = pyautogui.position()[0] * self.sensetivity
j.set_axis(vj.HID_USAGE_Z, eval(f"0x{x}"))
print(f"0x{x}")
j.update()
#time.sleep(0.01)
except Exception as e:
print(e)
#ev3.speaker.beep(frequency=1000, duration=500)
if __name__ == "__main__":
clutch = Clutch(10)Metadata
Metadata
Assignees
Labels
No labels