Holding program in Arduino Uno R3 when disconnecting from laptop

I have purchased an Arduino startup kit which includes the Arduino Uno R3 board. I have been working my way through "Arduino for Dummies"; I am now in the Button Sketch. I would like to add extra buttons to simulate a project having multiple inputs and outputs. I started with two - placed a button in parallel with the first, having its output leg sent to pin 3. I am using LEDs for loads.

The following sketch compiles, uploads and works exactly as desired; appropriate LED lights up when its button is pushed. However, even thought I'm using the supplementary power supply on the board, when I disconnect the RS232 cable, the circuit goes off and does its own thing (feat2out goes HIGH, ie. LED 2 goes on and stays on).

Is there something in the software to be written to keep a particular sketch loaded and operational in the UNO R3 when it is stand alone?

/*
Button

Turns on and off a light emitting diode(LED) connected to digital pin 8,
when pressing a pushbutton attached to pin 2. A delay has been incorporated
to provide a timed flash

This Sketch shows 2 button stages (features) to be operational

*/

const int feat1in = 2;
const int feat1out = 8;
const int feat2in = 3;
const int feat2out = 9;

int sig1in = 0;
int sig2in = 0;

void setup() {

pinMode(feat1out, OUTPUT);
pinMode(feat2out, OUTPUT);

pinMode(feat1in, INPUT);
pinMode(feat2in, INPUT);

}

void loop() {
// read the state of signal-in value:
sig1in = digitalRead(feat1in);
sig2in = digitalRead(feat2in);

if (sig1in == HIGH) {
digitalWrite(feat1out, HIGH);
delay(500);
digitalWrite (feat1out, LOW);}
else {
digitalWrite(feat1out, LOW);}

// read the state of signal_2-in value:

if (sig2in == HIGH) {
digitalWrite(feat2out, HIGH);
delay(500);
digitalWrite (feat2out, LOW);}
else {
digitalWrite(feat2out, LOW); }
}

Is there something in the software to be written to keep a particular sketch loaded and operational in the UNO R3 when it is stand alone?

No. Once loaded onto the Arduino the sketch will run when the board is appropriately powered whether or not it is connected to the PC.

even thought I'm using the supplementary power supply on the board, when I disconnect the RS232 cable,

What do you mean by "the supplementary power supply on the board" ? Which pins or connectors are you applying voltage to and at what voltage ?

Whoops, sorry. My non-expertise is showing.

I meant when the USB cable is disconnected - but you seem to have figured that out.

The power supply is the 9v adapter supplied with the kit with 2.1 mm center positive plug.

Try loading the Blink example. Does that run when disconnected from the PC ?

pinMode(feat1in, INPUT);
pinMode(feat2in, INPUT);

How are these inputs wired ? Do they have pulldown resistors to hold the inputs in a known LOW state when not pulled HIGH ? What is connected to the inputs ?

Problem solved.

Only the first input had a pulldown resistor. I added resistors to the next three inputs and all inputs/outputs (4) are working fine. Arduino can operate stand-alone with its own power supply and disconnected from my laptop.

It’s a learning process, isn’t it?

Retired