The Arduino Starter Kit Project 2- Non LED-light

Hi,
Do you have a DMM? (Digital MultiMeter)

Tom.. :grinning: :+1: :coffee: :australia:

@janosch1 - Your code works, so check your wiring.

  • LED Anode + (long leg) goes to Signal (Pins 3, 4, 5).
  • LED Cathode - (short leg, flat side) goes to Ground.

Here is a simulation of your code and wiring. Hold the button for desired effect.

When you Upload the sketch to the UNO do the RX and TX lights blink for a short time?

Hi, @

UPLOAD this code, then open the IDE Monitor, set for 9600 baud.
Tell us what is displayed when you press and release the buttons.

Check that you get SETUP COMPLETE on the display when you press the controller reset button.

int switchPin = 2;
int greenledPin = 3;
bool switchstate;

void setup()
{
  Serial.begin(9600);
  pinMode(switchPin, INPUT);
  pinMode(greenledPin, OUTPUT);
  Serial.println("SETUP COMPLETE");
  delay(2000);
}

void loop()
{
  if (switchstate == LOW)
  {
    Serial.println("BUTTON NOT PRESSED");
    digitalWrite(greenledPin, LOW);
  }
  else
  {
    Serial.println("BUTTON NOT PRESS");
    digitalWrite(greenledPin, HIGH);
  }
}

Tom... :grinning: :+1: :coffee: :australia:

@TomGeorge , @xfpd , @jim-p

BRAKING NEWS – Break through- Solution- Its working now! Amazing!



1 Like

@xfpd
Your guess with the wiring. I check that before. Just read an early post from my here in the chat.

@xfpd @TomGeorge

The Solution was a two-step-action.
1st step:
@xfpd : Great, my code is working. Check! I have double-checked my wiring! So that was in place!
Great test and by way. The visualization that helped me massive. I have never heard WOKWI before. Great tool! When do you use it?
2nd step:
@TomGeorge
"Try to upload that code...." Click! UPLOAD MY CODE? I HAVE TO UPLOAD MY CODE? I have just verified my code Arduino IDE-the check button. But I have never ever clicked the upload button with the arrow key to the right. So, after I have done that the circuit was working how it should be.

That can happened when no one is beside me and guidance me in the real world. :slight_smile:

So, a massive thank you to all of you. I appreciated your support. @xfpd @jim-p @TomGeorge @PaulRB
p.s. So I carry on in my Nook with project nr 3. I guess, It wouldn't be that last time that I will post something and ask the forum for support. :slight_smile:

I use wokwi for testing user code, explaining, new ideas and fun... without needing hardware.

Glad you got it working.
Now for lesson 3

:+1: :+1: :+1: :+1: :+1: :+1:

1 Like

@xfpd
Cheers! Nice! I will use it in the future!

Cheers! Yap, looking forward to the next one.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.