Hye guys..I have problem with my arduino..I use my arduino one servo motor, 2 gas sensor, 1 LM35 and 4 relay module..The problem is after the arduino running at the loop function then it keep restart to setup function.. i need the code to running in loop function..can anyone help me please..thank you
Wild guess is that it's drawing too much current and resetting the board. If you're powering (as opposed to controlling) the servo and the relays from the Arduino that's quite likely.
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?
Code and circuit will help us to advise you on how to fix your problem.
Please include what sort of power supplies you are using, for Aduino, what type, and for the servos, two gas units and relay PCB.
Links to data/specs on the servos, relay PCB and especially the gas sensors.
Please reformat your code for correct indentation and re-post. It's too hard to read at the moment and follow the logic. There doesn't appear to be anything too wild that would cause memory issues, so most likely a circuit issue as per other posters.
Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.
Unfortunately this not a circuit diagram, it shows no component information.
Where is your gnd of the UNO connected to the gnd of the servo 5V 2A suppy.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Not a fritzy.