2020-03-12 11:53 PM
2020-03-13 02:33 AM
Hi danielspronk9 ,
To write data by flow, the following payload must be sent to probe out node ,with the topic “write�? :
{
"variablelist": [
{
"address": "0x20000060",
"type": 4,
"value": "xxxx"
}
],
"accesspoint": 0
}
My proposed solution with standard nodes is :
I have added a slider to generate the value (but can be done by any node) then the “template�? node formats the payload, and the change node set the topic.
the template node content :
The variable address and variable type must be filled here. For the type and address, the easiest way it to try first with a write panel and a debug node, and see the values. The payload value from input will be inserted in the template. (the value to write).
The next node is a “change�? to set the topic to write
the result :
When the slider is moved, the new value is written to g_constDouble
I attach the 3 nodes flow to the message.
Let me know if it is ok.
Best regards
Landry
2020-03-13 02:12 AM
Hello danielspronk9 ,
Can you give me more information on your usecase ?
-You want to write always the same value when you click on your button ?
-You want also a text box to enter the value before clicking on the button write ?
Everything is possible with STM32CubeMonitor :smiling_face_with_smiling_eyes: , that's why i need more explanation.
Thank you,
Landry
2020-03-13 02:21 AM
Hi Landry,
thanks for your fast answer.
I use the write panel to change intern variables, this works fine.
Now i want change variables over a switch, a button or a slider but i dont know how it is possible.
For the beginning i want change a variable to a fix value if i press a button.
regards
2020-03-13 02:33 AM
Hi danielspronk9 ,
To write data by flow, the following payload must be sent to probe out node ,with the topic “write�? :
{
"variablelist": [
{
"address": "0x20000060",
"type": 4,
"value": "xxxx"
}
],
"accesspoint": 0
}
My proposed solution with standard nodes is :
I have added a slider to generate the value (but can be done by any node) then the “template�? node formats the payload, and the change node set the topic.
the template node content :
The variable address and variable type must be filled here. For the type and address, the easiest way it to try first with a write panel and a debug node, and see the values. The payload value from input will be inserted in the template. (the value to write).
The next node is a “change�? to set the topic to write
the result :
When the slider is moved, the new value is written to g_constDouble
I attach the 3 nodes flow to the message.
Let me know if it is ok.
Best regards
Landry
2020-03-13 03:30 AM
Thanks you, it works :)
But one more question. Is it possible to use the variable name not the address? the address can change and then it didnt work any more.
2020-03-13 08:32 AM
It's mandatory to send addresses to the probe. You can use a "trick" by using information containing in the node variables ( mapping names <-> addresses ).
I copy a flow example for the variable called "sum".
When you update your executable file, you can do an automatic update of addresses by opening and saving your variable configuration file.
It's not fully automatic but better than nothing.
2020-04-20 05:37 AM
Hi,
On the variables node, put this in a function block, it will store the adress in the "global" flow context, and can referenced when doing the writing.
msg.payload.variablelist.forEach(myFunction);
function myFunction(item, index) {
if (item.name == "direction"){
flow.set('direction_adr',item.address);
}
if (item.name == "current_limit"){
flow.set('current_limit_adr',item.address);
}
in a template note:
{"variablelist":[{"address":"{{flow.current_limit_adr}}","name":"current_limit","type":5,"checked":true,"value":"{{payload}}"}],"accesspoint":0}
}
2020-10-06 02:14 PM
Hello,
I follow the instruction and receive this error:
10/6/2020, 5:31:11 PMnode: ST Link out
"Bad parameter (7)"
msg : string[264]
"Unsuccessful write (Bad parameter (7)) on 48FF6E064986484820270787, for data = "{\n \"variablelist\": [\n {\n \"address\": \"0x20000000\",\n \"type\": 3,\n \"value\": \"3678\"\n }\n ],\n \"accesspoint\": 0\n}": write"
Do you know what's wrong with it? I check the address and type and they are correct.
2021-11-11 04:59 AM
Hi,
I have the same error
2021-11-11 05:01 AM
Hello,
I follow the instruction and receive this error:
"Bad parameter (7)"
msg : string[264]
"Unsuccessful write (Bad parameter (7)) on 48FF6E064986484820270787, for data = "{\n \"variablelist\": [\n {\n \"address\": \"0x20000000\",\n \"type\": 3,\n \"value\": \"3678\"\n }\n ],\n \"accesspoint\": 0\n}": write"
Do you know what's wrong with it? I check the address and type and they are correct.