Hello!
ST has also free tools. There is a free development environment (no limitation whatosever).
There is quite some code as well. And the ARM architecture is really ubiquitous, the boards
are extremely cheap and powerful (I just bought a nucleo with a F7 processor. A lot of Flash,
a lot of RAM, running at 216 MHz and for 25 USD.
Using CubeMX is the right way to do 90% of the job. In your case, the project is so simple that
it would rather be 99.9%.
A nucleo board is anyway 10000 times too powerful for what you are trying to do, but as I suppose
you will start from there and then develop more enhanced programs, this is likely to be a good choice.
You can choose basically any of the boards, they are all in the same price range.
Now for your problem, I suppose you have already a detector, right? I'm not sure what kind of output
you get, but if it's like, say, Panasonic's Napion, you simply get a on / off output when somebody
approaches. In this case, you have to detect on an input port and drive the backlight with a PWM.
Don't use a delay as stated in the title!!!
What you have to do:
- Start CubeMX, configure it for the board you have on your desk (new project, then choose).
- Choose one free GPIO (they are in gray on the CPU map).
- Click it and choose GPIO_EXTx, x being the number of the pin. I'm doing it at the same time,
for example in my case, I have clicked PH3, and the menu shows GPIO_EXTI3.
- Choose another GPIO for PWM
Generate the code.
- Once generated, open your IDE, go to the code and add an interrupt function in order to receive the
detector interrupt.
- Write your PWM function (example SetBacklight(uint8 val)).
The next step would be to fade in and fade out slowly, using SysTick.
Etc...
Dora