Thanks for the replies.
@scruss:
I forgot to mention those two files, but I did include them before. I found the error in the way I was using my programm. Now that I have all the Files needed I got past the first error, but a second one has occured.
is the code I used while getting this error:
Im not sure but I thought that when you define an argument and add a value as it is in the code above on line 10, it converts the argument to an optional argument. But I still get the error for the missing arguments. Do you have any idea how I can fix this problem?
@BillTodd:
I saw your answer to my question and im thankfull for your suggestion, but beacause of the urgent matter of this projekt I have no time to test your suggestion. I will come back at a later time to test it but for now I will try and fix my programm. I hope you can understand.
@scruss:
I forgot to mention those two files, but I did include them before. I found the error in the way I was using my programm. Now that I have all the Files needed I got past the first error, but a second one has occured.
Code:
from machine import Pinfrom Used.rotary import Rotaryfrom sys import platformclass RotaryIRQ(Rotary): def __init__(self, pin_num_clk, pin_num_dt, min_val=0, max_val=10, reverse=False, range_mode=Rotary.RANGE_UNBOUNDED, pull_up=False): super().__init__(min_val, max_val, reverse, range_mode, pull_up) if pull_up == True: self._pin_clk = Pin(pin_num_clk, Pin.IN, Pin.PULL_UP) self._pin_dt = Pin(pin_num_dt, Pin.IN, Pin.PULL_UP) else: self._pin_clk = Pin(pin_num_clk, Pin.IN) self._pin_dt = Pin(pin_num_dt, Pin.IN) self._enable_clk_irq(self._process_rotary_pins) self._enable_dt_irq(self._process_rotary_pins) def _enable_clk_irq(self, callback=None): self._pin_clk.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=callback) def _enable_dt_irq(self, callback=None): self._pin_dt.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=callback) def _disable_clk_irq(self): self._pin_clk.irq(handler=None) def _disable_dt_irq(self): self._pin_dt.irq(handler=None) def _hal_get_clk_value(self): return self._pin_clk.value() def _hal_get_dt_value(self): return self._pin_dt.value() def _hal_enable_irq(self): self._enable_clk_irq(self._process_rotary_pins) self._enable_dt_irq(self._process_rotary_pins) def _hal_disable_irq(self): self._disable_clk_irq() self._disable_dt_irq() def _hal_close(self): self._hal_disable_irq()
Code:
Traceback (most recent call last): File "<stdin>", line 9, in <module> File "Used/rotary_irq_pico.py", line 10, in __init__TypeError: function takes 8 positional arguments but 6 were given
@BillTodd:
I saw your answer to my question and im thankfull for your suggestion, but beacause of the urgent matter of this projekt I have no time to test your suggestion. I will come back at a later time to test it but for now I will try and fix my programm. I hope you can understand.
Statistics: Posted by Quadropol — Wed Mar 20, 2024 7:41 pm