four leds output blink sequence

Wire up four LED's to pins 0-4 of the Fubarino. Modify the program so that it does nothing until a button is pressed. When the button is pressed, successively light up one LED until all four are lit with a one second delay between each light. Then wait one more second and shut off all LED's. If the button is pressed again it will repeat the behavior described above.

this was the first code of a pull up just a switch

/*
Blink with a Decision
*/
uint16_t PIN_OUT = 1; // 
uint16_t PIN_IN = 16; // 
void setup() {
pinMode(PIN_OUT, OUTPUT);
pinMode(PIN_IN, INPUT);
}
void loop() {
digitalWrite(PIN_OUT, !digitalRead(PIN_OUT)); // toggle the LED
if( digitalRead(PIN_IN) == LOW ) { // Made decision
delay(200); // True condition
}
else {
delay(1000); // False condition
}
}

this is my attempt to put four leds

uint16_t PIN_OUT = {0,1,2,3}; // 
 uint16_t PIN_IN = 4; // 
void setup() {
pinMode(0,PIN_OUT, OUTPUT);
pinMode(1,PIN_OUT, OUTPUT);
pinMode(2,PIN_OUT, OUTPUT);
pinMode(3,PIN_OUT, OUTPUT);
pinMode(4,PIN_IN, INPUT);
}
void loop() {
digitalWrite(PIN_OUT, !digitalRead(PIN_OUT)); // toggle the LED
if( digitalRead(PIN_IN) == LOW ) { // Made decision
delay(000); // True condition
}
else if ( condition 0 is false) 
{
delay(1000); // False condition
}
else if (condition 1 is false )
{
delay(1000); // False condition
}
else if ( condition 2 is false )
{
delay(1000); // False condition
else if (condition 3 is false )
{
delay(1000); // False condition
}
}

my current error before posting

scalar object 'PIN_OUT' requires one element in initializer

ajaramillo909:
scalar object 'PIN_OUT' requires one element in initializer

And how many elements do you have in the initializer?

If you want PIN_OUT to be an array you should declare it as one:

uint16_t PIN_OUT[4] = {0,1,2,3}; //

You pinMode calls are all wrong. They should be:

void setup() {
pinMode(PIN_OUT[0], OUTPUT);
pinMode(PIN_OUT[1], OUTPUT);
pinMode(PIN_OUT[2], OUTPUT);
pinMode(PIN_OUT[3], OUTPUT);
pinMode(PIN_IN, INPUT);
}

How is you button wired? Do you have it wired to 3.3V or GND?

For the button Im just using a wire. i have my ground and 3.3v on the fubrino. thank you im trying Ive been doing this for three weeks until the world fell apart.

One leg of your button is to pin 16. What is the other leg of your button connected to? Do you have a pull-up or pull-down resistor?

Arduino uploads the program but with wrong results. My LED pen0 is blinking with a delay of 1 sec.LED pen3 just stays on and all this is happening with me controling it without a switch. I think I should delete the delay code and replace with (something==HIGH). But I cant figure why the LEDs are even on without the High Switch

uint16_t PIN_OUT[4] = {0,1,2,3}; //
 uint16_t PIN_IN = 4; //
void setup() {
pinMode(PIN_OUT[0], OUTPUT);
pinMode(PIN_OUT[1], OUTPUT);
pinMode(PIN_OUT[2], OUTPUT);
pinMode(PIN_OUT[3], OUTPUT);
pinMode(PIN_IN, INPUT);
}
void loop() {
digitalWrite(PIN_OUT[0], !digitalRead(PIN_OUT[0])); // toggle the LED
if( digitalRead(PIN_IN) == LOW ) { // Made decision
}
else {
   delay(1000);   //false condition
}
if( digitalRead(PIN_OUT[0]) == LOW ) { // Made decision
delay(0000); // True condition
}
else {
   delay(1000);  //false condition
}
if( digitalRead(PIN_OUT[1]) == LOW ) { // Made decision
delay(0000); // True condition
}
else {
   delay(1000);  //false condition
}
if( digitalRead(PIN_OUT[2]) == LOW ) { // Made decision
delay(0000); // True condition
}
else {
   delay(1000);  //false condition
}
if( digitalRead(PIN_OUT[3]) == LOW ) { // Made decision
delay(0000); // True condition
}
else {
   delay(1000);  //false condition
}
}

Your input pin is floating between HIGH and LOW and could be either at any time.

Change
pinMode(PIN_IN, INPUT);
to
pinMode(PIN_IN, INPUT_PULLUP);
then 'read' PIN_IN understanding that LOW is the actuated state.

In our previous tutorial, we learnt about Blinking a LED using PIC microcontroller and built the same circuit on Perf board. Then we used PICkit 3, ICSP and MPLAB IPE for dumping the program onto our Perf board. Now, in this tutorial we will advance our self to using more pins on the PIC microcontroller myaarpmedicare.com