Help me im lost (Watering System Using Arduino)

CAN someone please help me with my program im confused to what to do.
what i wanted is to compile or merge seperate kinds of program in my arduino UNO R3 cause im making a
prototype for my project @school it is a Automatic Watering System Using Soil Moisture and With something to do with Stepper motor and here is the program

#include <AccelStepper.h>
#define HALFSTEP 8

// Motor pin definitions
#define motorPin1 3 // IN1 on the ULN2003 driver 1
#define motorPin2 4 // IN2 on the ULN2003 driver 1
#define motorPin3 5 // IN3 on the ULN2003 driver 1
#define motorPin4 6 // IN4 on the ULN2003 driver 1

// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup() {
stepper1.setMaxSpeed(1000.0);
stepper1.setAcceleration(100.0);
stepper1.setSpeed(600);
stepper1.moveTo(15000);

}//–(end setup )—

void loop() {

//Change direction when the stepper reaches the target position
if (stepper1.distanceToGo() == 0) {
stepper1.moveTo(-stepper1.currentPosition());
}
stepper1.run();
}

this is for the stepper motor to move back and forth while watering the plants and the program for the watering system is this one

int AC water pump = 13;
int soil moisture sensor = 8;
int val;
void setup() {
pinMode(13, OUTPUT);
pinMode(8, INPUT);
}
void loop() {
val = digitalRead(8);
if (val == LOW)
{
digitalWrite(13, LOW);
}
else
{
digitalWrite(13, HIGH);
}
delay(400);
}

what i wanted is to merge it into one program so can someone please help me how to make this happen cause my deadline for the project is this thursday so i would appreciate if someone please help me im desperate ;D ;D :’( :’(

Get rid of the delay in the watering part so the stepper part can work right. The blink without delay example shows how.

Combining sketches.

Please read the stickies about posting!
Using a 'quote' was a good try - but your code is in fact

There is a smiley with glasses in the code you posted....

val = digitalRead(8);

Does it feel right?

—-> hence the need to use code tags

Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
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.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please tell us your electronics, programming, Arduino, hardware experience?

Have you written any major part of the code, just pasting bits together that you have found will not teach you programming.

Have you tested the bits of code you have pasted together and made sure they do what you want before you cut and paste?

Tom... :slight_smile:

For starters a stepper motor and pressurized water are not going to mix very well.

I reckon you need to keep the electronics and the power supply completely separated from the device that sprays the water.

sorry for my newbie skills in posting
but
here is the thing my watering system is an idea of a friend of mine he come up with an idea watching YT and mixed two (2) different system and want to combine the two.

1st link --------> Automatic Watering System for Plants using Arduino - YouTube
2nd link --------> http://www.instructables.com/id/IoT-Automatic-Plant-Watering-System/

what we wanted was to make a system like the first link but has the back and forth thingy with the stepper motor in the 2nd link

the things we have is:

2 Channel relay module
Arduino Uno R3
Soil Moisture Sensor
Submersible mini water pump
and the stepper motor 28BYJ-48 and its driver

In this things i just tweak my little knowledge in electronics to make it work somehow but

i manage to make the stepper motor move to what i wanted and the water pump/soil moisture thing i also manage to make it function Seperately but what i really want to happen is to have a watering system where it function with the soil moisture and simultaneously making the back and forth thing with the stepper motor as you can see in the second link. I dont know how to post the picture of the device i made cause it says that file is too large. I know i have a lot of issue but please help our deadline is in 2 days

EDIT:
Another thing is that i pasted the program of the 1st link to the program for the stepper motor
28BYJ-48 Stepper Motor with ULN2003 driver and Arduino Uno – 42 Bots <---------- this is the link where i got the program for stepper motor.
and i put it up and what happens is the watering system is working while the stepper motor driver is only blinking but as i said it works when you program it seperately.