I was doing some Arduino projects 5 years ago and now have more time to do more. I am relearning about the Arduino and using SimulIDE for code and circuit development as I travel.
When I setup the an Arduino Nano and upload the example Blink - the onboard LED changes from bright yellow to dark blue (the captured image shows the Blink program running and the LED 'on'). When I change the circuit and the code as below:
Here is an image of the LEDs when they are 'on':
Is this a bug in SimulIDE? Or is there a problem with my circuit or my code?
Thank you!
When I setup the an Arduino Nano and upload the example Blink - the onboard LED changes from bright yellow to dark blue (the captured image shows the Blink program running and the LED 'on'). When I change the circuit and the code as below:
- Code:
int LED1 = 13;
int SW1 = 12;
int LED2 = 11;
void setup() {
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(SW1, INPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED1, HIGH);
digitalWrite(LED2, LOW);
int varSW = digitalRead(SW1);
if (varSW == 1) {
digitalWrite(LED1, LOW);
/ digitalWrite(LED2, HIGH);
}
}
Here is an image of the LEDs when they are 'on':
Is this a bug in SimulIDE? Or is there a problem with my circuit or my code?
Thank you!