Tagged: Arduino
- AuthorPosts
Hello
I’m trying to have sensor data from the Arduino Uno be shown real time on a graph but also changing the label but I’m unsure of what the syntax is because it doesn’t seem to work. I’ve tried using these commands:
Serial.print(“ST<{\”cmd_code\”:\”set_text\”,\”type\”:\”label\”,\”widget\”:\”label1\”,\”value\”:66.66,\”format\”:\”%.2f\”}>ET”);
Serial.print(“ST<{\”cmd_code\”:\”set_value\”,\”type\”:\”line_series\”,\”widget\”:\”line_series1\”,\”index\”:”);
Serial.print(i); //i is the index
Serial.print(“,\”value\”:”);
Serial.print(n); //n is the filtered and adjusted pulse oximeter value
Serial.println(“}>ET”);Any ideas?
In the first command, you set the type “cmd_code” to “set_text” and the parameter to “value”. It is necessary that the command type matches the parameters. If the command type is “set_text”, then the parameter must be “text”, and for the “value” parameter, the command type is “set_value”.
Oh that was a typo but I believe I did try the set_value and changing the value too but that also didn’t work. When do you use set_text and when do you use set_value? What’s the difference?
For the second command the parameters match and it still doesn’t work…
If both “set_value” and “set_text” (each with its own parameter) do not work, then you need to check the widget name and the absence of spaces inside quotes in the names of commands, parameters, etc.
For text widgets, I mostly use “set_text”. I don’t see the point in “set_value”, because anyway, the number needs to be converted to text before inserting it into this command.
You can test the execution of commands using the terminal program that comes with Stone Designer. So it is much easier to learn the features of the execution of each command than to change the firmware of the microcontroller every time. I just tested using the terminal commandST<{“cmd_code”:”set_value”,”type”:”line_series”,”widget”:”line_series1″,”index”:4,”value”:38}>ET
and it works fine, the line on the graph changes.
There is nothing wrong with the second command. Have you checked the serial port level? Is the communication normal? Can use Serial.println(“ST<{\”cmd_code\”:\”sys_reboot\”,\”type\”:\”system\”}>ET”);Test the one-way communication
- AuthorPosts
- You must be logged in to reply to this topic.