Skip to main content

FLAG TAKE

Syntax​

FLAG TAKE <n>

Description​

Reads event flag n (1–64) and clears it. Use it to consume an event exactly once. To read a flag without clearing it, use FLAG PEEK.

Response​

FLAG <n> <0|1>

1 means the flag was raised (it is now cleared); 0 means it was not raised.

Errors​

ReplyCondition
ERR FLAG TAKE bad_argMissing argument or flag outside 1–64.

Example​

flag_take.py
from hmcls_udp import Board

board = Board("192.168.1.11")
board.request("FLAG SET 3")
print(board.query("FLAG TAKE 3")) # ['FLAG 3 1']
print(board.query("FLAG TAKE 3")) # ['FLAG 3 0']