Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5302

MicroPython • Re: Frequency counter stops after while

$
0
0
Hm - strange. I meade only two changes in code. First: PWM output to: pwm = PWM(Pin(4))
and second: print(frequency)

Code:

def readout(a):    global frequency    frequency = ((out[1] << 8) | out[0]) / gate_time    print(frequency)
conection of pins 4 and 15 gives output below

Code:

>>> %Run -c $EDITOR_CONTENT>>> 999.01000.0999.01000.0999.01000.0
conection of frequency generator to pin 15 gives output below:

Code:

>>> %Run -c $EDITOR_CONTENT>>> 0.00.00.00.00.00.00.0
Also, after starting the code for the first time everything is ok, starting it second time gives an error:

Code:

>>> %Run -c $EDITOR_CONTENTTraceback (most recent call last):  File "<stdin>", line 2, in <module>  File "PWMCounter.py", line 9SyntaxError: invalid syntax
After that, I have to reconect the PICO over USB, to be able to run the code again...

Statistics: Posted by California — Thu Feb 29, 2024 10:11 pm



Viewing all articles
Browse latest Browse all 5302

Trending Articles