Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

mblock example of 4 momentary push buttons and one logic output for Arduino Nano board

hafrse

Full Member level 3
Full Member level 3
Joined
Aug 6, 2007
Messages
167
Helped
1
Reputation
2
Reaction score
3
Trophy points
1,298
Activity points
2,402
Hello,

Need Mblock example for Arduino Nano board according to the below:

I have 4 momentary push buttons B1-B4 (momentary keyboard buttons) and one digital output DI which I need to code to one latched output O1 to values according to:
so the inputs are B1-B4 and DI, output is O1 (from a logic sensor). to the Nano board.
All 4 momentary push buttons are pulled up to +5V via resistors: when pressed, logical output is 0V, when not pressed +5V

Logic needed:

Buttons should be scanned(endless loop)
initial value of logical output O1 = Steady (latched) high on power on
When button B1 is momentary pressed (0V) , logical output value of O1 = steady(latched) High
When button B2 is momentary pressed (0v) , logical output value of O1 =steady(latched) Low
When button B3 is momentary pressed (0V) , logical output value of O1 = steady(latched) High
When button B4 is momentary pressed (0V) , logical output value of O1 = steady(latched) High
When DI is low (0V), logical output value O1 = steady(latched) High
many thanks in advance!
George
--- Updated ---

Corrections:
Hello,

Need Mblock example for Arduino Nano board according to the below:

I have 4 momentary push buttons B1-B4 (momentary keyboard buttons) and one digital output DI which I need to code to one latched output O1 to values according to:
so the inputs are B1-B4 and DI (from a sensor with digital output), output is O1 (from a logic sensor). to the Nano board.
All 4 momentary push buttons are pulled up to +5V via resistors: when pressed, logical output is 0V, when not pressed +5V

Logic needed:

Buttons should be scanned(endless loop)
initial value of logical output O1 = Steady (latched) high on power on
When button B1 is momentary pressed (0V) , logical output value of O1 = steady(latched) High
When button B2 is momentary pressed (0v) , logical output value of O1 =steady(latched) Low
When button B3 is momentary pressed (0V) , logical output value of O1 = steady(latched) High
When button B4 is momentary pressed (0V) , logical output value of O1 = steady(latched) High
When DI is low (0V), logical output value O1 = steady(latched) High
many thanks in advance!
George
 
Last edited:

BradtheRad

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 1, 2011
Messages
14,754
Helped
2,872
Reputation
5,756
Reaction score
2,888
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
110,268
It seems that High is the universal output state for all conditions except one, namely B2 pressed. The question is, what output state do you wish in the event that both B2 and another button are pressed? It leads to conflict. Which button is ignored?
 

hafrse

Full Member level 3
Full Member level 3
Joined
Aug 6, 2007
Messages
167
Helped
1
Reputation
2
Reaction score
3
Trophy points
1,298
Activity points
2,402
One button at a time,
What I want to achieve is that I want to set a latched output O1=Digital pin9 to 'low' state only when I press button B2=Pin2 and only reset that latched output to its initial 'high' state (on startup it is set to 'high') when one of the B1 (Pin1) ,B3(Pin2),B4(Pin4) buttons are pressed or DI( Pin5) sensor signal is gone to low state.
I did a first draft, not sure if that works as expected.
Thanks
 

Attachments

  • mblock_block_1676188129989.png
    mblock_block_1676188129989.png
    230.5 KB · Views: 25
Last edited:

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,269
Helped
4,741
Reputation
9,503
Reaction score
5,127
Trophy points
1,393
Activity points
154,156
Hi,

Is this a school project? Homework?
Why don't you test it on an Arduino?
Did you try to you ask chatGPT?

Klaus
 

hafrse

Full Member level 3
Full Member level 3
Joined
Aug 6, 2007
Messages
167
Helped
1
Reputation
2
Reaction score
3
Trophy points
1,298
Activity points
2,402
I am trying to repair an vintage tape recorder, one of the custom logic chip has a bad input and wanted to build that function using Arduino. I am new to mblock and only wanted some input on how to code but I think I am on the right track after reading some posts, will test when I receive the Arduino in the end of next week.
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top