Some basic help required with programming logic

Hello,

I'm pulling my hair out over what I suspect is a simple problem for which I cannot work out the logic.

Basically, I have two digital inputs, to make it simple lets say pin 1 and 2, which when pin 1 is pulled low I want the onboard LED (pin 13) to illumate, AND when pin 2 is also low I want it to flash.

if pin 1 is NOT low I want the LED to be off, irrespective of pin 2.

I cannot for the life of me work out the logic required, do I need if statements and a while loop?

Sorry if this is a stupid question, but I cannot work this out :slightly_frowning_face:

Really appreciate any help on this!

Indeed, you qualify for the standard “hair pulling” exemption:

The 10 top clues that suggest that a poster will be hard to help:
10 - uses goto statements
9 - is building a speedometer, line following robot or automated chicken coop door
8 - wants to make a normally expensive thing “for cheap”
7 - “urgently needed” or “due tomorrow”
6 - POSTS IN UPPER CASE
5 - “final year project” or “class project”
4 - says “can’t wrap my head around…”, “bare with me”, or “pls” or “plz” anything
3 - trying to “merge” two or more sketches
2 - uses Fritzing
1 - “// Variables will change” is still in the program
Note: “tearing my hair out” is omitted because it is usually associated with extremely simple solutions.

Have you seen the BlinkWithoutDelay example?

Sounds like you just need some if else statements.

pseudo-code:

if pin 1 is low
    if pin 2 is low
        flash the led
    else
        turn the led on
else
    turn the led off.

aarg:
The 10 top clues that suggest that a poster will be hard to help:
10 - uses goto statements
9 - is building a speedometer, line following robot or automated chicken coop door
8 - wants to make a normally expensive thing "for cheap"
7 - "urgently needed" or "due tomorrow"
6 - POSTS IN UPPER CASE
5 - "final year project" or "class project"
4 - says "can't wrap my head around...", "bare with me", or "pls" or "plz" anything
3 - trying to "merge" two or more sketches
2 - uses Fritzing
1 - "// Variables will change" is still in the program
[/quote]
That's awesome. I like 9.

Delta_G:
Sounds like you just need some if else statements.

pseudo-code:

if pin 1 is low

if pin 2 is low
       flash the led
   else
       turn the led on
else
   turn the led off.

Thank you, I’ve managed to get it to work now, for some strange reason I was trying to do it with a while statement. I think my brain has had enough for one day :sleeping:

9 - is building a speedometer, line following robot or automated chicken coop door

You forgot the blinds.