Please fix my code, it would be much apreciated

I have one line of code that i think should work, but am unsure about why it doesn't. Any help you could give me would be much appreciated. Highlighted in red is the problem line

#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 6 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 24 // Popular NeoPixel ring size

int col1 = 0 ;
int col2 = 0 ;
int col3 = 0 ;

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 1000 // Time (in milliseconds) to pause between pixels

void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(AVR_ATtiny85) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.pinMode(13,INPUT);
pinMode(12, INPUT);
pinMode(13, INPUT);
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
int col1 = 50 ;
int col2 = 50 ;
int col3 = 50 ;
Serial.begin(9600);

}

void loop() {
if (digitalRead(12) == HIGH) { //very scuffed and never works
delay(100);
if (digitalRead(12) == LOW) {
if (col1<=255){
col1 = col1 +51;
Serial.println(col1);
Serial.println(col2);
Serial.println(col3);
Serial.print("_____________");
} else {
if (col2<=255){
col2 = col2 +52;

Serial.println(col1);
Serial.println(col2);
Serial.println(col3);
Serial.print("_____________");
} else {
col3 = col3 + 52;

Serial.println(col1);
Serial.println(col2);
Serial.println(col3);
Serial.print("_____________");
}
}

}
}
for (digitalRead(13) == HIGH ;col1>255 || col2>255 || col3>255; col1++;col2++;col3++) {
delay(10);
}
// if (digitalRead(13) == HIGH) { //kinda scuffed but works sometimes
// delay(100);
// if (digitalRead(13) == LOW) {
//col1 = col1 + 35;
// col2 = col2 + 35;
// col3 = col3 + 35;
//Serial.println(col1);
// Serial.println(col2);
// Serial.println(col3);
// Serial.print("_____________");

//if (col1 >= 255) {
//col1 = 1;
//col2 = 1;
//col3 = 1;
//}
//}
//}

for (int Pin = 0; Pin < 25; Pin++) {
pixels.setPixelColor(Pin, pixels.Color(col1, col2, col3));
pixels.show(); // Send the updated pixel colors to the hardware.

}
}

//if (Pin == 24) {
// for (int Bin = 0; Bin < 25; Bin++) {
// pixels.setPixelColor(Bin, pixels.Color(255, 255, 255));
// pixels.show(); // Send the updated pixel colors to the hardware.
// delay (0);
//}
// delay (8000);
// pixels.clear();
// delay (150);
//}

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Did you write this code?
What is it supposed to do?

Thanks.. Tom.. :slight_smile:

Hi,

 for (digitalRead(13) == HIGH ;col1>255 || col2>255 || col3>255; col1++;col2++;col3++)

That is not the format for a for..loop.

Tom... :slight_smile:

I have absolutely no idea what you are trying to achieve with this for-loop.
That's three lightyears away of how for-loops are used.

So please describe in normal words what you want to do.
best regards Stefan

this is a joke right?

Congratulations! This is the strangest for loop I have ever seen:

  for (digitalRead(13) == HIGH ;col1>255 || col2>255 || col3>255; col1++;col2++;col3++) {
  delay(10);
  }

Congratulations! This is the strangest for loop I have ever seen:

Don't encourage that, they will make it a feature and then one more thing we have to deal with.