Basic push button logic help

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
cmkielo
Posts: 2
Joined: Thu Apr 12, 2018 5:13 pm
Contact:

Basic push button logic help

Post by cmkielo »

Hi guys,

I'm a newbie to flowcode, i'M currently using a switch array to solve the below switching behaviour- hopefully someone can suggest a more elegant solution, any hints would be welcome.

Problem = 5 push buttons that each toggle, with the 5th used as a reset.
controller behaviour =
7 buttons (B1 to B7) and 5 LEDs (L1 to L5).
B1 toggles L1 on/off
//
B5 toggles L5 on/off
B6 sends just sends hex
B7 sends just sends hex
B5 turns L1-4 off.

Regards,
Chris
Attachments
testerrrrr.fcfx
(34.96 KiB) Downloaded 180 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Basic push button logic help

Post by medelec35 »

Hi Chris,
lets take this one step at a time.
First step is toggle.
The XOR is used for toggling and the & is used for masking.
For example:

Code: Select all

Output = Output XOR PortAInput & 15
Will only toggle port A bits 0 to 3.

Code: Select all

Output XOR PortAInput & 7
Will only toggle port A bits 0 to 2 etc.
That should give you a good helping hand.

Martin
Martin

cmkielo
Posts: 2
Joined: Thu Apr 12, 2018 5:13 pm
Contact:

Re: Basic push button logic help

Post by cmkielo »

Thanks for the pointers martin,

Regards,
Chris

Post Reply