You are building a simple event handling system where different event codes (0 to 4) trigger different actions.
Each event type corresponds to a specific function:
Event Code | Trigger Type | Function |
0 | Button Press | on_button() |
1 | Timer Expire | on_timer() |
2 | UART Received | on_uart() |
3 | Power On | on_power() |
4 | Error Detected | on_error() |
You must:
Example-1
Input: 1
Output: Timer Expired
Example-2
Input: 3
Output: Power On
Example-3
Input: 5
Output: Unhandled Event
Input
0
Expected Output
Button Pressed