Skip to content

Commit 51813d4

Browse files
update TCP client example with register update before sending response, related to #31, found during #51
1 parent 033927d commit 51813d4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

examples/tcp_client_example.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,13 @@ def my_inputs_register_get_cb(reg_type, address, val):
106106
format(reg_type, address, val))
107107

108108
# any operation should be as short as possible to avoid response timeouts
109-
# It would be also possible to read the leatest pin state at this time
110-
val[0] += 1
111-
client.set_ist(address=address, value=val)
109+
new_val = val[0] + 1
110+
111+
# It would be also possible to read the latest ADC value at this time
112+
# adc = machine.ADC(12) # check MicroPython port specific syntax
113+
# new_val = adc.read()
114+
115+
client.set_ireg(address=address, value=new_val)
112116
print('Incremented current value by +1 before sending response')
113117

114118

0 commit comments

Comments
 (0)