programin help needed

i trying to make a light train with a button witch changes the light modes from strobe light to normal light
but my program always shows an error please help o jeah and i have a usb positive in pin 12.

train light.ino (734 Bytes)

your code is full of errors and invalid constructs. there's no "do" loop in C/C++; there is a do/while. do't understand why there is a 2nd loop() within loop(). In other case have no idea what was intended

the following code detects button presses to toggle between 2 modes, one which toggles the LED on/off and the other mode where the LED are just turned on.

int lampPin = 10;
int butPin  = A1;
int mode    =  0;

// -----------------------------------------------------------------------------
void setup () {
    pinMode (butPin,  INPUT_PULLUP);
    pinMode (lampPin, OUTPUT);
    
    Serial.begin (115200);
}

// -----------------------------------------------------------------------------

int butLst = HIGH;

void loop (){
    int but = digitalRead (butPin);
    if (butLst != but)  {
        butLst = but;
        if (LOW == but)  {
            mode = ! mode;
            Serial.println (mode);
        }
    }
    
    if (mode)  {
        digitalWrite (lampPin, HIGH);
        delay (100);
        digitalWrite (lampPin, LOW);
        delay (100);
    }
    else {
        digitalWrite (lampPin, LOW);
    }
}

Your code has so many errors I don't even know where to start.

The posted code:

int mode(1);
int lamp[1]={12};
int gomb[1]={A0};
void setup() {
 pinMode(gomb ,INPUT);
 for(int i=0;1<10;i++){
   pinMode(lamp[i],OUTPUT);
   for(int j=0;j<255;j++){
     analogWrite(lamp[i],j);
     delay(1);
   }
     analogWrite(lamp[i],0);
 }
Serial.begin(115200);
}

void loop(){
 if (gomb==HIGH){
   do{
     int (mode + 1);
   }
 }
 
   if(mode(1)){
   void loop(){
     analogWrite(lamp[i],255);
     delay(100);
     analogWrite(lamp[i],0);
   }
 }
 
   if(mode(2)){
   void loop(){
     analogWrite(lamp[i],255);
     delay(50);
     analogWrite(lamp[i],127);
   }
 }
if ((gomb==HIGH) (mode=2)){
do{
   int(mode - 1);
 }
}
while (mode>10);
}