Im trying to use the read function from the pigpio library inside of a pigpiod script. Here is how:

detect = pi.store_script('tag 1 inr p0 r4 jp 1 tag 2 r 4 jz 2 tag 3 inr p1 r 4 jp 3 jmp 1')

My problem: the jp command does not account the read on gpio 4 as a value in any way and i cant figure out how to alter a parameter or variable according to what "r 4" outputs. To make things clear: I am trying make my script increase p0 every loop while a Button connected to gpio 4 is pressed and continue with the script after the button has been released. But my script simply doesnt change its outcome if i press the button or if i dont.


1 Answer 1


The JP command jumps on greater than or equal to zero. It's of no use in checking a GPIO level as 0 and 1 are treated the same.

Change JP to JNZ.

  • Thanks that solved the problem. Seems like i was way overthinking and should better have worked on my basic maths. Thank you very much
    – Alex
    Apr 17, 2021 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.