Start with all of the leds off. Using an interrupt have the button cycle through Only Red ON Only Green ON Only Blue ON White Light ON All Off

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

cross mob
Anonymous
Not applicable

I am a new and i am trying to solve this.

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Attached is my trial.

But if this is an assignment at your class,

please try it by yourself first 😉

moto

View solution in original post

0 Likes
5 Replies

You have 5 different states, a "switch" statement may cover all those. Set in the (debounced) button interrupt handler a global variable which you check in the infinite main loop. When set, advance to next LED-state and reset the variable.

Which kind of hardware are you using? Kit ?? Which one???

Bob

0 Likes

meemo,

I recomment to start with simple button switch example for KIT-042, which you can find here:

ButtonSw32: button switch debouncer component

Start with PSoC4 basic example, which has 3 buttons and 3 onboard LED. Once it works, add extra code (like if..then..else) to modify for your need.

ButtonSw_P4_basic_1a.png

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Attached is my trial.

But if this is an assignment at your class,

please try it by yourself first 😉

moto

0 Likes