🎚 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.
Changing variable using manual typing. | Changing variable using slider. |
⏩ Quick import nodes
1) Open STM32CubeMonitor and press Import code (Ctrl + I):
2) Now just copy the example code below, paste it in software and press Import:
json_slider_stm32cubemonitor_example.txt
*code on screenshot could be not exact, as in txt file
3) Press Import copy:
4) Now you can see new Flow 1, so just delete the first one (your default):
5) Now that's all, but we need to make some configuration for your specific STM32CubeIDE project. ⬇
Initial Configurations
1) Because you've insert my JSON code, you should change executable file to the your project, so open myVariables node:
2) Now you can see the mine Executable file (from Buzzer library project), press on the pencil to change another (your):
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:
4) Find the variable, that you need to monitor (the variable should be global, not local) and press Update:
5) Now you can see full list of the chosen variables, including the actual address in the RAM and type:
🎚 Slider Configuration
1) In the slider node you can set the range and step, in my case I want to change frequency:
from 0 Hz | to 4000 Hz | with step 1 Hz |
and perform changing right way (continuously while sliding):
2) The next node (template node) copy this code:
|
And paste (Also chooseOutput as: Parsed JSON):
address
Actual address of the variable you can find out in the myVariables node:
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 type | Note |
1 | uint8_t | |
2 | ||
3 | uint32_t | Not sure |
10 | Boolean | Not sure |
3) In change nodetype in to the value: write:
Testing
1) Press DEPLOY and then DASHBOARD:
In case of white screen just switch to the Home (left up corner):
2) Press START ACQUISTION:
3) That's all, if you set all correct the value could be changed by slider:
🔊 Example
I used this convenient method to find the best buzzing sounds frequencies:
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)
- Comments