Note: You need to make the pwm timer instance global so you can access it in the setup() and callback functions. In other words, increment the duty cycle of the PWM signal by small increments at every callback call to the periodic interrupt, from 0 to 100, then decrement from 100 to 0 and repeat.Įxperiment with different PWM increment/decrement values and different periodic function callback frequency, in order to observe a gradual change of brightness of the LED as you sweep the duty cycle. Sweep up/down/up/down and repeate the duty cycle of the PWM signal. In the periodic callback function perform the following routine: Create a periodic timer to execute a callback function 5Hz and setup another timer to generate a PWM signal on the LED pin (PA5). We want to use the PWM signal to control the built-in LED, PA5, which can only be connected to Channel 1 of TIM2 (other pins may be connected to either of two channels of two timers).įollowing the examples from prelab 4. You can choose any timer to be the source of the periodic callback, but you can only choose specific timers for generating PWM signals, depending on the timers' capability and depending on the output pins available for use. platform = ststm32įramework = ardui no src_filter = - + Questionsįor this task you need to create 2 timers, one periodic and one for generating a PWM signal. If we don't add this filter line, all the files inside the folder src will be compiled. The last line (src_filter) basically tells the platformio configurator to remove all main*.cpp from the compile list, then add only the specific mainQ1.cpp file. Replace the content of the platformio.ini with this, then change mainQ1.cpp to the file name you wish to compile. ![]() ![]() ![]() To have one project with multiple source files, where you only compile one at a time, you need to configure platformio.ini to only compile the file you want. You only need to submit the ( mainQ1.cpp, mainQ2.cpp, etc) files for this assignment. ME319 Prelab 4 Project Creation & Submissionįor this assignment, it is suggested that you create a single project with multiple main*.cpp files, inside the src folder, for each question below. USB Type A to USB Mini-B Connector References In this assignment you will be practicing setting up timers and interrupts.īefore attempting this assignment, make sure you go through the Prelab 4 document first.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |