Showing results for 
Search instead for 
Did you mean: 

stm32 code to control brightness of 2 lamps using 2 triacs

Associate III

Merhaba 2 triyak kesinti ile araç kullanmak istiyorum bunun için ne yapmalıyım? 50hz 220v şebeke elektriğini kullanıyorum. 0 noktasını tespit ettikten sonra belli bir süre bekleyip ardından triyak'a darbe veriyorum. İkinci darbe değerini verdiğimde sistem karışıyor.


kodum ek dosyada:



ST Employee


Please write in English as it's an international community so you will have more chance to get support from the members.

Thank you for your understanding.


Hello, I want to drive with 2 triac interruptions, what should I do for this? I use 50hz 220v mains electricity. After detecting point 0, I wait for a certain period of time and then pulse the triac. When I give the second pulse value, the system gets confused.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Muhammed Güler
Senior III

öncelikle google translate ile de olsa sorununu ingilizce yazman gerekiyor.

Coming to your question, using delay in interrupt is a big mistake.
Within exti interrupt; You should do short tasks like checking outputs, setting and starting timers.
Or you can change the value of a variable in the interrupt and check it in the main loop.
There are many approaches, the important thing is to get out of the interrupt as quickly as possible

Muhammed bey size linkedin üzerinden ulaşabilir miyim?

I'm having problems with the language, thank you for your reply

I actually set the timmer value in the interrupt