I have a question about coding.

Hello, I am a student practicing coding in school, and I am reaching out to you with a question that I am hoping you could help answer.

To give you a brief explanation of the operating principle- when water is applied to the humidity sensor, the temperature sensor will initiate. When the temperature reaches or exceeds above 60 degrees, the pulse signal will be HIGH, at which point the stepping motor will initiate and the passive buzzer will sound.

However, I would like to write a code that prevents the stepping motor from initiating when the output signal is "LOW" during low voltage transfer. Would you be able to help me with this request? I appreciate any advice that you can provide.

Have you tried writing something? At least have a go at it and post it here using code tags.

#include<Stepper.h>
int steps = 2048;
int temp = 0;
int steam = 1;
int pb = 13;
Stepper stepper(steps,11,9,10,8);

void setup() {
Serial.begin(9600);
stepper.setSpeed(10);
pinMode(pb, OUTPUT);
}

void loop() {

int reading = analogRead(temp);
int steam = analogRead(steam);
Serial.print("tamp : ");
Serial.println(reading);
Serial.print("steam : ");
Serial.println(steam);
delay(10);
if(reading > 70 && steam > 70)
{
tone(pb, 200);
stepper.step(steps);
}
else
{
noTone(pb);
stepper.step(-steps);
}
}

I tried to combine them with coding.

Please post a circuit diagram. With no comments I have trouble working out how temp, steam and pb relate to the temperature (I can guess this one), humidity and pulse signal, output signal and particularly "low voltage transfer" that you talk about in your description.

Steve

fnb111:
Have you tried writing something? At least have a go at it and post it here using code tags.

Why do people find that the hardest part...

But having "combine codes" as a starting point for writing a program is the most terrible one. Take a step back and think of what YOU want to do in baby steps. Then look at the examples and see how to use stuff like libraries. Then try to realize what you want.