Appendix B: Lua extensions
Miscellaneous functions 79
BBBBB
Lua extensions
tcu_slog
Purpose: Log to syslog
Format: tcu_slog (priority, message)
priority: Values:
3 = Error
4 = Warning
6 = Info
7 = Debug
message: String to log.
Return value:
Error code: 0=OK, <0=error
Example: local str = string.format('Pin %d is low',
5);
tcu_slog(4, str)
;
Result:
00:46:36.479 WARNING:lua_task: Pin 5 is low
tcu_serial_baud
Purpose: Set bit rate on the serial RS-232 connection
Format: tcu_serial_baud (bit_rate)
bit_rate: Values:
4800, 9600, 14400, 19200, 38400, 57600, 115200
Return value:
Error code: 0=OK, <0=error
Example: -- Set bit rate to 38.4 kbit/s
tcu_serial_baud(38400)