🎚 How to use slider in STM32CubeMonitor for change variable value?

Summary

Hola! 😉 In the previous article we've learned how to change value of the global variables using STM32CubeMonitor.

✍ How to write (change) variable value in STM32CubeMonitor?

Yep, it's very useful, but it's possible to do the same in STM32CubeIDE. Anyway this two approaches not convenient for quick and proportional configurations, so in this article you will see how to add slider, that can act as ordinary tuning resistor. 

Image

Changing variable using manual typing.

Image

Changing variable using slider.

⏩ Quick import nodes

1) Open STM32CubeMonitor and press Import code (Ctrl + I):

Image

2) Now just copy the example code below, paste it in software and press Import:

json_slider_stm32cubemonitor_example.txt

Image*code on screenshot could be not exact, as in txt file

3) Press Import copy:

Image

 4) Now you can see new Flow 1, so just delete the first one (your default):

Image

5) Now that's all, but we need to make some configuration for your specific STM32CubeIDE project. ⬇

Image

Initial Configurations

1) Because you've insert my JSON code, you should change executable file to the your project, so open myVariables node:

Image

2) Now you can see the mine Executable file (from Buzzer library project), press on the pencil to change another (your):

Image

3) You can find this file (.elf) in the Debug folder of the project directory, copy path to this folder and insert in Folder field, File will load automaticly:

Image

4) Find the variable, that you need to monitor (the variable should be global, not local) and press Update:

Image

5) Now you can see full list of the chosen variables, including the actual address in the RAM and type:

Image

🎚 Slider Configuration

1) In the slider node you can set the range and step, in my case I want to change frequency:

from 0 Hzto 4000 Hzwith step 1 Hz

and perform changing right way (continuously while sliding):

Image

2) The next node (template node) copy this code:

  1. {
  2. "variablelist": [
  3. {
  4. "address": "0x20000070",
  5. "type": 3,
  6. "value": "{{payload}}"
  7. }
  8. ],
  9. "accesspoint": 0
  10. }
  11.  

And paste (Also chooseOutput as: Parsed JSON):

Image

address

Actual address of the variable you can find out in the myVariables node:

Image

type

As you can see in type stroke the variable type is choosing by number, in my case it's uitn32_t.

Actually I don't where it come from and find you this just by sliding, but anyway it's important to choose correct type to prevent affecting adjacent RAM areas.

type (number)Actual typeNote
1uint8_t
2
3uint32_tNot sure
10BooleanNot sure

3) In change nodetype in to the value: write:

Image

Testing

1) Press DEPLOY and then DASHBOARD:

Image

In case of white screen just switch to the Home (left up corner):

Image

2) Press START ACQUISTION:

Image

3) That's all, if you set all correct the value could be changed by slider:

Image

🔊 Example

I used this convenient method to find the best buzzing sounds frequencies:

Image

https://www.youtube.com/shorts/hZ-cyJmwrZI

🤔 Conclusions

Slider simple but much more powerful instrument than just typing value manually.

This extremely useful when you working with:

  • Motors (regulating speed)
  • Servos (rotation able regulation)
  • Light (brightness regulation)
945
No comments yet. Be the first to add a comment!
Cookies?