debug_print()
Description
Prints data to an initialized peripheral.
Syntax
debug_print(debug_text[], data...);
Parameters
Variable | Input |
|---|---|
| Can either be text: “demo text“, “demo text data: %i, %x, %X, %f“ |
| data variables which user wants to pass for printing. Maximum amount of variables should not exceed 10. |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | Success |
SCRIPT_OPERATION_FAILED | Failed |
Function call example
Example of debug_print
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
#include <socket>
#include <debug>
#define RS232_SPEED 115200
#define WORD_LENGTH WORDLENGTH_8
#define STOP_BITS STOPBITS_1
#define PARITY PARITY_NONE
new data_1 = 15;
new data_2 = 20;
new predefined_string[20] = "Use example No.4\r\n";
main()
{
Init(RS232, RS232_SPEED, WORD_LENGTH, STOP_BITS, PARITY);
debug_init(RS232);
// Use example No.1:
debug_print("Use example No.1");
// Use example No.2:
debug_print("Use example No.2.\r\n data_1: %i \r\n", data_1);
// Use example No.3:
debug_print("Use example No.3.\r\n data_1: %i \r\n %i \r\n", data_1, data_2);
// Use example No.4:
debug_print(predefined_string);
while(1)
{
Delay(100);
}
}Notes and Warnings
In order to disable debug print messages user can remove #include <debug> and recompile script. To re-enable debug print messages user should add #include <debug> as shown in line 9 of an example.