Combining Two Arduino Circuits

Hello, I am attempting to combine circuits 1 with a single blinking LED and circuit 4 which runs a servo. I plugged in everything exactly how it is in the diagrams but cannot combine the codes. I keep getting error messages. Can someone help me combine these two code? The first code is

*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

And the second code for circuit 4 is:

// Sweep
// by BARRAGAN http://barraganstudio.com

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

Please post your attempts at combining the programs and the error messages that you get.

you must remove this

*/

at the beginning of the code

I tried combing the codes like seen below but I got the error message that there was a redefinition of void loop and void setup. I then attempted to change void loop to void loops and void setup to void startup which seemed to work in terms of coding but only allowed the light to light up. The mini servo would not start up. Also, I did everything on CIRC 1 map and CIRC 2 map but plugged my light into 3.3v and my servo into 5v. I also removed the */ but there was still the problems I listed.

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

In principle, you need to copy the contents of one of the setup() functions into the other one; same with loop().

Have a look here.

This is what I have so far but only the top code is working. The bottom code has no effect.

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

/*
*Blink
*Turns on an LED on for one second, then off for one second, repeatedly.
*The circuit:

  • LED connected from digital pin 13 to ground.
  • Note: On most Arduino boards, there is already an LED on the board
  • connected to pin 13, so you don’t need any extra components for this example.

*Created 1 June 2005
*By David Cuartielles
*http://arduino.cc/en/Tutorial/Blink
*based on an orginal by H. Barragan for the Wiring i/o board
*/

int ledPin = 13; // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void startup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loops() method runs over and over again,
// as long as the Arduino has power

void loops()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}

The bottom code has no effect

Because you don't call it?