Who have the factory Program preloaded on XCM4500 Relax Kit?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
I have a KIT_XMC45_RELAX_V1,but I don't konw how to use IO003 and IO004, especial the Input usage.
I want to leran the face factory program preloaded on XCM4500 Relax Kit, it realized the function that button1 control led1 and button2 control led2.
0 Likes
3 Replies
Not applicable
Hi,

I don't have the preloaded program but it is quite simple to control the function of the LEDs and Buttons.
All you need is IO004 app.
For LEDs, set it to output and for Buttons, just leave it default which is input.
Then uses the API, IO004_ReadPin to read the value from Button then toggle/set/reset the LEDs.

Example:
		
bool PinInput = 1;

PinInput = IO004_ReadPin(IO004_Handle2); // Read BUTTON1
if(PinInput == 0)
{
IO004_TogglePin(IO004_Handle0); // Toggle LED1
PinInput = 1;
}

PinInput = IO004_ReadPin(IO004_Handle3); // Read BUTTON2
if(PinInput == 0)
{
IO004_TogglePin(IO004_Handle1); // Toggle LED2
PinInput = 1;
}
0 Likes
Not applicable
I had check your code,it need to eliminate the shaking from button.
0 Likes
Not applicable
Hi,

Yes, this is just a simple code to show how to control the LED and button.
In order for the button work properly, you need to have the debounce function implemented.
0 Likes