2020-03-21 11:44 AM
I have a thermistor hooked up to the nucleo-l432kc to obtain temperature and display that temp on an LCD, print it to the screen, and light up a specific colour of an RGB LED. I want to be able to combine two colours of an RGB LED in different amounts, so not just have them both ON at full, but instead have one a bit less than the other (to make orange). I tried this using PWM and it worked, but for some reason it causes other parts of my circuit/program to malfunction (it ends up displaying an incorrect temp only when I use PWM and I do not know why). Any suggestions how to do this only using gpio outputs?
2020-03-21 05:33 PM
There are a few ways.
1) Set up an interrupt to happen at 1kHz. Within that interrupt, set RGB pin values based on the color mix you want.
2) Set up a circular memory to GPIO->BSRR peripheral DMA transfer to happen at 1kHz (or whatever) and define values to get the mix you want.
2020-03-22 11:06 PM
To create analog adjusting levels with a digital output, you need some modulation, typically PWM. If you create PWM signal not using timer peripheral, that is still the same PWM signal, only with less effective use of MCU resources.
Understand and solve the real problem, not search for some magic "solutions"!