Fix beduino command issue
This commit is contained in:
parent
2d71d06dc5
commit
436fec17d2
@ -1,85 +0,0 @@
|
|||||||
# Techage/Beduino I/O Module
|
|
||||||
|
|
||||||
I/O modules support the following functions:
|
|
||||||
|
|
||||||
### event
|
|
||||||
|
|
||||||
Every signal that is sent to an I/O module triggers an event on the controller.
|
|
||||||
Events can be queried using the `event()` function.
|
|
||||||
If the function returns the value `1`, one or more signals have been received.
|
|
||||||
Calling `event()` resets the event flag.
|
|
||||||
|
|
||||||
```c
|
|
||||||
event()
|
|
||||||
```
|
|
||||||
|
|
||||||
### read
|
|
||||||
|
|
||||||
Read a value from a remote techage block.
|
|
||||||
|
|
||||||
- *port* is the I/O module port number
|
|
||||||
- *cmnd* is the command, like `IO_STATE` (see example code "ta_cmnd.c")
|
|
||||||
|
|
||||||
```c
|
|
||||||
read(port, cmnd)
|
|
||||||
```
|
|
||||||
|
|
||||||
### send_cmnd
|
|
||||||
|
|
||||||
Send a command to a techage block (see [commands](https://github.com/joe7575/beduino/blob/main/BEPs/bep-005_ta_cmnd.md)).
|
|
||||||
|
|
||||||
- *port* is the I/O module port number
|
|
||||||
- *topic* is a number from the list of [Beduino commands](https://github.com/joe7575/beduino/blob/main/BEPs/bep-005_ta_cmnd.md)
|
|
||||||
- *payload* is an array or a string with additional information, depending on the command. If no additional commands are required, "" can be used.
|
|
||||||
|
|
||||||
```c
|
|
||||||
send_cmnd(port, topic, payload)
|
|
||||||
```
|
|
||||||
|
|
||||||
### request_data
|
|
||||||
|
|
||||||
Request information from a techage block (see [commands](https://github.com/joe7575/beduino/blob/main/BEPs/bep-005_ta_cmnd.md)).
|
|
||||||
|
|
||||||
- *port* is the I/O module port number
|
|
||||||
- *topic* is a number from the list of [Beduino commands](https://github.com/joe7575/beduino/blob/main/BEPs/bep-005_ta_cmnd.md)
|
|
||||||
- *payload* is an array or a string with additional information, depending on the command. If no additional commands are required, "" can be used.
|
|
||||||
- *resp* is an array for the response data. The array must be defined large enough to hold the response data.
|
|
||||||
|
|
||||||
```c
|
|
||||||
request_data(port, topic, payload, resp)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Functions for TA4 Display and TA4 Display XL
|
|
||||||
|
|
||||||
### clear_screen
|
|
||||||
|
|
||||||
Clear the display.
|
|
||||||
|
|
||||||
- *port* is the I/O module port number
|
|
||||||
|
|
||||||
```c
|
|
||||||
clear_screen(port)
|
|
||||||
```
|
|
||||||
|
|
||||||
### append_line
|
|
||||||
|
|
||||||
Add a new line to the display.
|
|
||||||
- *port* is the I/O module port number
|
|
||||||
- *text* is the text for one line
|
|
||||||
|
|
||||||
```c
|
|
||||||
append_line(port, text)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### write_line
|
|
||||||
|
|
||||||
Overwrite a text line with the given string.
|
|
||||||
|
|
||||||
- *port* is the I/O module port number
|
|
||||||
- *row* ist the display line/row (1-5)
|
|
||||||
- *text* is the text for one line
|
|
||||||
|
|
||||||
```c
|
|
||||||
write_line(port, row, text)
|
|
||||||
```
|
|
@ -116,8 +116,9 @@ techage.register_node({"techage:ta3_soundblock"}, {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||||
|
print("ta3_soundblock", topic, payload[1], payload[2])
|
||||||
if topic == 1 then
|
if topic == 1 then
|
||||||
if payload[1] == 0 then
|
if payload[1] == 1 then
|
||||||
play_predefined_sound(pos)
|
play_predefined_sound(pos)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user