Skip to content

Commit

Permalink
update TCP client example with register update before sending respons…
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics committed Jan 6, 2023
1 parent 033927d commit 51813d4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/tcp_client_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ def my_inputs_register_get_cb(reg_type, address, val):
format(reg_type, address, val))

# any operation should be as short as possible to avoid response timeouts
# It would be also possible to read the leatest pin state at this time
val[0] += 1
client.set_ist(address=address, value=val)
new_val = val[0] + 1

# It would be also possible to read the latest ADC value at this time
# adc = machine.ADC(12) # check MicroPython port specific syntax
# new_val = adc.read()

client.set_ireg(address=address, value=new_val)
print('Incremented current value by +1 before sending response')


Expand Down

0 comments on commit 51813d4

Please sign in to comment.