Skip to content

Instantly share code, notes, and snippets.

@nbuchwitz
Created May 7, 2021 09:51
Show Gist options
  • Save nbuchwitz/e761260687a78ad5596013a48fff4ed4 to your computer and use it in GitHub Desktop.
Save nbuchwitz/e761260687a78ad5596013a48fff4ed4 to your computer and use it in GitHub Desktop.
import revpimodio2
def ev(name, value):
# payload is bytes, so we need to know the enconding (eg. ascii, utf-8, etc...)
print(name, value.decode('ascii'))
rpi = revpimodio2.RevPiModIO(autorefresh=True, monitoring=True)
rpi.handlesignalend()
# define IO: change length of string in the frm argument
rpi.io['Output_1_i06'].replace_io('a_string', frm='30s')
# register event handler function
rpi.io.a_string.reg_event(ev)
rpi.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment