Newbie here, trying to merge two sketches

Both sketches work fine by themselves.

I get that the setup and void and sections are independent (so to speak)
I’ve moved those portions into the correct areas.

I must be doing something wrong. I just don’t understand enough of C++ (or any coding for that matter) to really even be here. But I am trying.

So maybe someone can help me and fix this?
here’s the idea

I have 3 sets of LED’s to be powered eventually, all with the same LED code. I’m currently only using one to get both portions of my project to work properly together before I start adding more LED’s.

Each set of LEDs have 4 bulbs. I am also attempting to run a Stepper motor to lower and raise an (Unidentified Flying) Object (which will have the lights inside it).

I can follow the pin coding pretty well, and understand the change of values, but it’s the syntax errors that keep getting me. Especially the missing { when they are there.

But I have other errors as well. Maybe someone could fix it, and tell me what they did, why, and how to avoid these mistakes again?

I appreciate any help, and please take it easy on me. I’ve only had this UNO for about 3 weeks. I’ve copied files from online which have made each part of the project work (don’t remember where I got em though), and am just having issues merging them. You tube hasn’t been much help, and it’s late, and I don’t have time to keep messing with it tonight. I’d really like to get to the point where all this works and I can start soldering it together so that I can clean up my kitchen table before my wife stabs me with a spoon.

/*
 * MotorKnob
 *
 * A stepper motor follows the turns of a potentiometer
 * (or other sensor) on analog input 0.
 *
 * http://www.arduino.cc/en/Reference/Stepper
 * This example code is in the public domain.
 */

// Pin 2 IN 1
// Pin 3 IN 2
// Pin 4 IN 3
// Pin 5 IN 4
// 5V to battery, ground to Gnd on Arduino


#include "Stepper.h";

// change this to the number of steps on your motor
#define STEPS 48


// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to


// Define Constants
// Steps per Rev
const float STEPS_PER_REV = 32;
const float GEAR_RED = 64;
const float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED;

//Number of steps per geared rotation

// the previous reading from the analog input
int previous = 0;
int StepsRequired;
Stepper stepper(STEPS, 2, 4, 3, 5);
/* Lights Portion for Green LED
 *  
 */
 byte ledPin[] = {9, 8, 7, 6, 7, 8, 9}; // Create array for LED pins
int ledDelay = 10; // delay between changes
int direction = 1;
int currentLED = 0;
unsigned long changeTime;

void setup() [
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(700);
}

{for (int x=0; x<10; x++)
{
// set all pins to output
pinMode(ledPin[6, 7, 8, 9], OUTPUT);
}
changeTime = millis();
]

void loop() {
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  stepper.step(10250);
  delay(2000);

  stepper.step(-10250);
  delay(10000);

  // remember the previous value of the sensor
  previous = val;
}
if ((millis() - changeTime) > ledDelay)
{
// if it has been ledDelay ms since last change
changeLED();
changeTime = millis();
}
}
void changeLED()
 {
for (int x=0; x<10; x++)
{
// turn off all LED's
digitalWrite(ledPin[x], LOW);
}
digitalWrite(ledPin[currentLED], HIGH); // turn on the current LED
currentLED += direction; // increment by the direction value
// change direction if we reach the end
if (currentLED == 9) {direction = -1;}
if (currentLED == 0) {direction = 1;}
}
void setup() [

Definintely wrong. Function definitions always use { and } around the body of the function.

You have a lot of rogue { braces in your code.

At this point, I think it is too badly messed up to continue. Go back to the original code that you had in the two files. You have one sketch which runs the motor and one which runs the LED? Rename the setup() and loop() from each of those so you have setupLED() and setupMotor() and loopLED() and loopMotor().

Now write a new setup() and loop() which call those functions...

void setup() {
  setupLED();
  setupMotor();
}
void loop() {
  loopLED();
  loopMotor();
}

That will compile at least. But it won't do what you want yet. The motor code (maybe/not sure) has some gigantic delay()'s in it. That will mess up the LED code which expects that you are going to call loopLED() at least 100 times per second (every 10 milliseconds.) So the motor code needs to be changed to use that same method of timing instead of using delay().

Lucky_Break:
I can follow the pin coding pretty well, and understand the change of values, but it's the syntax errors that keep getting me. Especially the missing { when they are there.

Here is a guide I wrote for error messages related to missing or extra brackets:
Common compiler errors caused by mismatched brackets:

"does not name a type" or
"expected declaration before" or
"expected unqualified-id before"
Usually means you forgot a '{' or put in an extra '}' in the previous function. Since all of the open brackets have been closed, the compiler is looking for further global declarations (variables or functions). If it finds something that looks like executable code instead of a global declaration it emits an error. Make sure that the brackets in the preceding function are in matching pairs '{' followed by '}'.

"a function-definition is not allowed here before '{' token"
(can cause: "'functionName' was not declared in this scope")
Usually means you forgot a '}' or put in an extra '{' in the previous function. Since a set of brackets has not been closed yet the compiler is looking for more code to put in the function. You can't declare a function inside a function so if the compiler finds a function declaration it emits an error. Make sure that the brackets in the preceding function are in matching pairs '{' followed by '}'.

"expected '}' at end of input"
Usually means you forgot a '}' or put in an extra '{' in the last function in the sketch. Since a set of brackets has not been closed yet, the compiler is looking for more code to put in the function. When it hits the end of the file instead it emits an error. Make sure that the brackets in the last function are in matching pairs '{' followed by '}'.

"expected primary-expression before '}' token"
Usually means you have an incomplete statement before a '}'. The block statement (between '{' and matching '}') can only contain complete statements. Complete statements always end with ';' (or '}' for a block statement).

Thank you both. It's not fixed, but it's getting in the right direction. I read some other forums this morning and it said to avoid using Delay because it ties up the boards memory and makes everything stop.

I was unaware until this morning, and confirmed by you that I can create subfolders in my setup (at least that's how I view it) so I will apply your suggestions and see if the forums I looked at earlier can help code it to do what I want as well by using milliseconds as my delay.

I'll let ya know!!

Also, maybe I should better explain my project for future visitors who may want to contribute:

I have a toy alien UFO which I want to add lights to and a stepper motor so it will lower from above and then stop, and after a set time, will reset. Nothing will be lit up or running (motor) until a button is pushed. Once the button is pushed, or perhaps, if I am able to, a code entered on a computer (button seems simpler to control) the lights will begin flashing, the motor will lower the toy from the sky, and pause when it reaches a determined height (figured by the number of steps). It will continue to flash while lowering and then once the motor receives the programming to reset (motor delay time) it will raise the device, stop the flashing and await input button again.

can help code it to do what I want as well by using milliseconds as my delay.

Help yourself. Read Using millis() for timing. A beginners guide, Several things at the same time and look at the BlinkWithoutDelay example in the IDE.