{"id":2855,"date":"2024-09-21T13:32:26","date_gmt":"2024-09-21T13:32:26","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=2855"},"modified":"2024-09-21T13:32:29","modified_gmt":"2024-09-21T13:32:29","slug":"getting-started-with-touchgfx-led-brightness-control","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=2855","title":{"rendered":"Getting Started with TouchGFX: LED Brightness Control"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"464\" height=\"109\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/images-2.png\" alt=\"\" class=\"wp-image-2856\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/images-2.png 464w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/images-2-300x70.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/images-2-400x94.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/images-2-250x59.png 250w\" sizes=\"(max-width: 464px) 100vw, 464px\" \/><\/figure><\/div>\n\n\n<p>In the third part of the TouchGFX, we shall control the LED brightness on board of STM32H735G-DK using the touch screen.<\/p>\n\n\n\n<p>By introducing this method, you can use this method to control brightness or anything else. You are limited by your imagination.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creating the UI.<\/li>\n\n\n\n<li>Developing the firmware.<\/li>\n\n\n\n<li>Results.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Creating the UI:<\/h2>\n\n\n\n<p>Open TouchGFX designer and create new project as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"257\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-1024x257.jpg\" alt=\"\" class=\"wp-image-2826\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-1024x257.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-300x75.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-768x193.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-1536x386.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-2048x514.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-1150x289.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-750x188.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-400x100.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-10-07-1-250x63.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then select your board, give the project a name and click on create.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"615\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-1024x615.jpg\" alt=\"\" class=\"wp-image-2827\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-1024x615.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-300x180.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-768x461.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-1536x922.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-2048x1230.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-1150x690.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-750x450.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-400x240.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-08_08-11-33-1-250x150.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When the project is created, add a slider as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"620\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-1024x620.jpg\" alt=\"\" class=\"wp-image-2857\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-1024x620.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-300x182.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-768x465.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-1536x930.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-2048x1240.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-1150x696.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-750x454.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-400x242.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-30-36-250x151.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Next, we shall add interaction as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"586\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-586x1024.jpg\" alt=\"\" class=\"wp-image-2859\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-586x1024.jpg 586w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-172x300.jpg 172w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-768x1342.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-879x1536.jpg 879w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-1172x2048.jpg 1172w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-1150x2009.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-750x1310.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-400x699.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07-250x437.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-07.jpg 1424w\" sizes=\"(max-width: 586px) 100vw, 586px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Trigger: Slider value changed.<\/li>\n\n\n\n<li>Slider: Slider1.<\/li>\n\n\n\n<li>Action: Call new virtual function.<\/li>\n\n\n\n<li>Function name: UpdateDutyCycle<\/li>\n<\/ul>\n\n\n\n<p>Thats all for the UI, click on the Generate Code as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"621\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-1024x621.jpg\" alt=\"\" class=\"wp-image-2860\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-1024x621.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-300x182.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-768x466.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-1536x932.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-2048x1243.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-1150x698.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-750x455.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-400x243.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_15-52-57-1-250x152.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Firmware Development:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Next, we shall go to the following folder:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">ProjectLocation\\ProjectName\\STM32CubeIDE<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Open the .project file and this will open the project within STM32CubeIDE as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"388\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-1024x388.jpg\" alt=\"\" class=\"wp-image-2833\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-1024x388.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-300x114.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-768x291.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-1536x582.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-2048x775.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-1150x435.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-750x284.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-400x151.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-51-250x95.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Next, select the work space and click on Launch as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"624\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-1024x624.jpg\" alt=\"\" class=\"wp-image-2834\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-1024x624.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-300x183.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-768x468.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-1150x701.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-750x457.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-400x244.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40-250x152.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-10-40.jpg 1188w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Wait until this window appears:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"286\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-1024x286.jpg\" alt=\"\" class=\"wp-image-2835\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-1024x286.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-300x84.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-768x215.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-750x210.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-400x112.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36-250x70.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-12-36.jpg 1030w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From Project Explorer, open STM32H735G-DK.ioc as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"294\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-1024x294.jpg\" alt=\"\" class=\"wp-image-2836\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-1024x294.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-300x86.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-768x221.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-1536x441.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-2048x588.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-1150x330.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-750x215.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-400x115.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-13-01-250x72.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>From the schematic of STM32H735G-DK we can find that LD8 which is connected to PF7 has the ability to be controlled by PWM as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"336\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-1024x336.jpg\" alt=\"\" class=\"wp-image-2861\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-1024x336.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-300x98.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-768x252.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-1536x504.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-2048x672.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-1150x378.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-750x246.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-400x131.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-07-57-250x82.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Configure the PF7 with TIM17_CH1 as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"623\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-1024x623.jpg\" alt=\"\" class=\"wp-image-2862\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-1024x623.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-300x182.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-768x467.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-1536x934.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-2048x1246.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-1150x699.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-750x456.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-400x243.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-14-41-250x152.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>For the timer configure, set the PSC to 5000 and the ARR to 100.<\/p>\n\n\n\n<p>Click on generate the code as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"572\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-1024x572.jpg\" alt=\"\" class=\"wp-image-2839\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-1024x572.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-300x167.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-768x429.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-1536x857.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-2048x1143.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-1150x642.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-750x419.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-400x223.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-06_08-36-48-1-250x141.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When the project finished generation, in main.c in user code begin 2, add the following the line to start the PWM generation as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">HAL_TIM_PWM_Start(&amp;htim17, TIM_CHANNEL_1);<\/pre><\/div>\n\n\n\n<p>Next, open the following source file from project explorer as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"245\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-1024x245.jpg\" alt=\"\" class=\"wp-image-2840\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-1024x245.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-300x72.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-768x183.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-1536x367.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-2048x489.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-1150x275.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-750x179.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-400x96.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-14_17-16-07-250x60.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>After opening the source file, open the screen1view header file as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"710\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-1024x710.jpg\" alt=\"\" class=\"wp-image-2863\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-1024x710.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-300x208.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-768x532.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-1536x1065.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-2048x1420.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-1150x797.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-750x520.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-400x277.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/2024-09-21_16-20-17-250x173.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Within the public section of the header file, add the following the virtual function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">virtual void UpdateDutyCycle(int value);<\/pre><\/div>\n\n\n\n<p>Note: the function name should be the same as the one in your TouchGFX interaction setup.<\/p>\n\n\n\n<p>Save the header file (CubeIDE has a bug that won\u2019t save the hpp file automatically nor during the building).<\/p>\n\n\n\n<p>In the source file, include the following header file:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#include &quot;main.h&quot;<\/pre><\/div>\n\n\n\n<p>Declare the timer handle as extern as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">extern TIM_HandleTypeDef htim17;<\/pre><\/div>\n\n\n\n<p>At the end of the source file, add the following function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">void Screen1View::UpdateDutyCycle(int value)\n{\n\t__HAL_TIM_SET_COMPARE(&amp;htim17, TIM_CHANNEL_1,value);\n\n}\n<\/pre><\/div>\n\n\n\n<p>When the slider values is changed, this function shall be called and update the duty cycle of the PWM and hence, the brightness of the LED.<\/p>\n\n\n\n<p>Save the source file.<\/p>\n\n\n\n<p>hat all for the guide.<\/p>\n\n\n\n<p>Save the project, build it and run it on your STM32H735G-DK board.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/07\/2024-07-12_15-03-3.jpg\" alt=\"\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. Results:<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"338\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/09\/ezgif-4-ce5ff3dbe7.gif\" alt=\"\" class=\"wp-image-2864\" \/><\/figure><\/div>\n\n\n<p>Happy coding \ud83d\ude09 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the third part of the TouchGFX, we shall control the LED brightness on board of STM32H735G-DK using the touch screen. By introducing this method, you can use this method to control brightness or anything else. You are limited by your imagination. In this guide, we shall cover the following: 1. Creating the UI: Open [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,19,11,12],"tags":[],"class_list":["post-2855","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-lcd","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/2855"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2855"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/2855\/revisions"}],"predecessor-version":[{"id":2865,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/2855\/revisions\/2865"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}