Code dosent work

#include <Stepper.h>
#define steps 32​

#include "dht.h"​
#define dht_apin A0 // Analog Pin sensor is connected to​

dht DHT;​

#define motion 4 //motion sensor connected to digital pin 7​
#define lightson 7 //LED connected to pin 7​
// Create variables:​
int movement;​
int count = 60; //initialize with ​

#include <Stepper.h>​

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution​
// for your motor​

// initialize the stepper library on pins 8 through 11:​
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);​

void setup() {​
// Configure the pins as input or output:​
pinMode(lightson, OUTPUT);​
pinMode(motion, INPUT);​

// Begin serial communication at a baud rate of 9600:​
Serial.begin(9600);}​
Serial.begin(9600);​
delay(500);//Delay to let system boot​
Serial.println("DHT11 Humidity & temperature Sensor\n\n");​
delay(1000);//Wait before accessing Sensor​
pinMode(7,OUTPUT);​
pinMode(6,OUTPUT);​
pinMode(5,OUTPUT);​
pinMode (4, OUTPUT);​
//end "setup()"}​
setup{​

Stepper.setSpeed(500); ​
//initialze serial communication at 9600 bits per second:​
Serial.begin(9600)};​
// set the speed at 60 rpm:}​
}​


// initialize the serial port:​
Serial.begin(9600);​
// initialize serial communication at 9600 bits per second:;​
Serial.begin(9600);​
// make the the water sensor an input and the relay control pin an output​
pinMode(8, INPUT);​
pinMode(10, OUTPUT);​
}​

void loop() {​
// Read out the pirPin and store as val:​
movement = digitalRead(motion);​
if (movement == HIGH) { //reset the counter if motion is detected​
count = 0;​
}​
if (count < 60){//if the LED has been on for less than 60 seconds (count = 1-60) or it is off (count = 0)​
if (movement == HIGH) {// If motion is detected (motion = HIGH), do the following:​
digitalWrite(lightson, HIGH); // Turn on the LED.​
count = count + 1; //add a second to the time its been on​
Serial.println("Motion detected!");​
Serial.println(count);​
}​
else {// If no motion is detected BUT the lights have been on for less than 60 seconds, keep counting​
}​

if (count == 60){ //if the led has been on for 60 second check for motion​
if (movement == LOW){ ​
digitalWrite(lightson, LOW); // Turn off the LED.​
Serial.println("No motion detected for 60 seconds - lights out");​
Serial.println(count); //count will stay at 60 until motion is detected​
}​
}​
delay(1000); //wait a sec​
}​
{ // Read out the pirPin and store as val:​
movement = digitalRead(motion);​
if (movement == HIGH) { //reset the counter if motion is detected​
count = 0;​
}​
if (count < 60){//if the LED has been on for less than 60 seconds (count = 1-60) or it is off (count = 0)​
if (movement == HIGH) {// If motion is detected (motion = HIGH), do the following:​
digitalWrite(lightson, HIGH); // Turn on the LED.​
count = count + 1; //add a second to the time its been on​
Serial.println("Motion detected!");​
Serial.println(count);​
}​
else {// If no motion is detected BUT the lights have been on for less than 60 seconds, keep counting​
}​

if (count == 60){ //if the led has been on for 60 second check for motion​
if (movement == LOW){ ​
digitalWrite(lightson, LOW); // Turn off the LED.​
Serial.println("No motion detected for 60 seconds - lights out");​
Serial.println(count); //count will stay at 60 until motion is detected​
}​
}​
delay(1000); //wait a sec​
}​
void loop() {​
// read the input on analog pin 0:​
int sensorValue = analogRead(A0);​
// print out the value you read:​
Serial.println(sensorValue);​
delay(100);​
if (sensorValue>50){​
Stepper.step(100);​
}​
delay(100);​
sensorValue = analogRead(A0);​
if (sensorValue<50){​
Stepper.step(-100);​
}​
Serial.println(sensorValue);​
delay(100);​
}​
void loop(){​
//Start of Program ​

DHT.read11(dht_apin);​

Serial.print("Current humidity = ");​
Serial.print(DHT.humidity);​
Serial.print("% ");​
Serial.print("temperature = ");​
Serial.print(DHT.temperature); ​
Serial.println("C ");​

delay(5000);//Wait 5 seconds before accessing sensor again.​
int tmp=21;​
if (tmp < DHT.temperature){​
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)​
digitalWrite(7, LOW); ​
digitalWrite(5, HIGH);​
digitalWrite(4, LOW);// turn the LED on (HIGH is the voltage level)​
}​
if (tmp > DHT.temperature) { ​
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)​
digitalWrite(6, LOW);​
digitalWrite(5, LOW);​
digitalWrite(4, HIGH);// turn the LED on (HIGH is the voltage level)​
}​

//Fastest should be once every two seconds.​

}// end loop(​
void loop() {​
// step one revolution in one direction:​
Serial.println("clockwise");​
myStepper.step(stepsPerRevolution);​
delay(500);​

// step one revolution in the other direction:​
Serial.println("counterclockwise");​
myStepper.step(-stepsPerRevolution);​
delay(500);​
}​
void loop() {​
// read the input pin:​
int flood = digitalRead(water_sensor);​
// print out the state of the button:​
Serial.print("Water (0=none, 1=water) = ");​
Serial.println(flood);​
if (flood == HIGH) { //close the soleniod by turning the relay connected to pin 10 on​
digitalWrite(water_relay,LOW);​
}​
else{ //leave the water soleniod open​
digitalWrite(water_relay,HIGH);​
}​
delay(1); // delay in between reads for stability​
}​

}

"Code dosent work" is not useful. In any case, I doubt that this code will even compile, much less "work" in some undefined fashion on some undefined Arduino.

Please read the locked posts at the top of this forum, and anything that they link to, etc., to learn how to properly post your code and how to ask questions.

Hello sheac6

What is not working ?

Why are there FIVE void loop() {​} in your code?

You MUST have only and only one void loop() {​}.

You should try basic examples.

Regards,
bidouilleelec

also, multiple setup() functions...?

// Practice formatting and posting </> your code 
// once you’ve fixed the obvious problems,
// then describe what your program’s meant to do when you re-post it.

Thanks, good luck

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.

Thanks.. Tom... :slight_smile: