cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hello all,

   

I have coded for the simple buttons on the PSoC 4 Pioneer Board, using the onboard slider elements as Buttons. It has compiled & build OK;

   

Then I programmed the board, successfully. The output was tuned to respective LED's on board (Red, Yellow, Blue);

   

But the problem I have is:

   

1.    It isn't holding the output i.e. I want a Toggled output but it just turns ON when touched & turns OFF when finger is removed.

   

What should get me out of it?

   

2.   Also can I have Percentile illumination to the LED's @ OFF state (20%) & ON state (100%) like it was in Ez-Click?

   

Thanks & Regards-

   

Amit

0 Likes
Reply
7 Replies
Esteemed Contributor II

1, You have to do the toggling yourself. Whenever there is a completed button access (finger - no finger) you should toggle a variable to indicate the new state.

   

2. Use a PrISM component to control brightness of an LED. Documented in its datasheet and examples available.

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

Hello Bob, Greetings.

   

I tried with an variable to hold the LED status but facing some issues:

   

Try 1 : Behaves same as without the variable.

   

Try 2 : Holds the o/p status permanent, I need to reset to bring it down.

   

Attached is the file with both modifications.

   

Please guide to better results.

   

Thanks & Regards-

   

Amit

0 Likes
Reply
Esteemed Contributor II

Sorry, Amit, I cannot do anything with a text-file. Please always use Creator -> File -> Create Workspace Bundle

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

Hi Bob, Greetings.

   

Sorry for the inconvenience. Here is the archived project.

   

Thanks & Regards-

   

Amit

0 Likes
Reply
Esteemed Contributor II

You are thinking too complicated. I made some changes to your project to ease program flow:

   
        
  • Some relevant #defines
  •     
  • Initialization
  •     
  • Renaming the flags, so they correspond to the LEDs (would be fine to change the name to "LEDState)
  •     
  • removing the else-parts
  •     
  • changing the logic
  •    
   

Didn't test, but should run

   

 

   

Bob

0 Likes
Reply
Anonymous
Not applicable

Hey Bob,

   

I tried your archive, but it was giving similar o/p to my Try 2 case i.e.

   

It light's up a LED but could not turn it off. Need to RESET to do so.

   

Please have it checked & help with sorted.

   

Thanks & Regards-

   

Amit

0 Likes
Reply
Esteemed Contributor II

Ok, tested and corrected.

   

 

   

Bob

0 Likes
Reply