Question

write a program using arduino , in which the water pump start and stop every 2...

write a program using arduino , in which the water pump start and stop every 2 1/2 minutes. ( can you post the results from the output please)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

int buttonPin1 = 2; //Start button
int buttonPin2 = 3; //Stop button
int greenLedPin = 6;//green led start status int
redLedPin = 7; //red led stop status int motorPin = 9; // the motor's pin
int buttonStatus1 = 0;
int buttonStatus2 = 0;

void setup() {
pinMode(motorPin, OUTPUT);
pinMode(greenLedPin, OUTPUT); pinMode(redLedPin, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}
void loop() {
buttonStatus1 = digitalRead(buttonPin1);
buttonStatus2 = digitalRead(buttonPin2);

if (buttonStatus1 == HIGH && buttonStatus2 == LOW) { // if the start button is pressed (AND stop button not) digitalWrite(motorPin, HIGH);// turn the motor ON
digitalWrite(greenLedPin, HIGH); //turn the green led indicator ON
digitalWrite(redLedPin, LOW); //turn the red led indicator OFF }

if (buttonStatus1 == LOW && buttonStatus2 == HIGH) { // if stop button is pressed (AND the start off)
digitalWrite(motorPin, LOW); // turn the motor OFF
digitalWrite(greenLedPin, LOW); //turn the green led indicator OFF
digitalWrite(redLedPin, HIGH); //turn the red led indicator ON
}
}

Add a comment
Know the answer?
Add Answer to:
write a program using arduino , in which the water pump start and stop every 2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the Arduino IDE, write a program for an Arduino board that will perform the following...

    Using the Arduino IDE, write a program for an Arduino board that will perform the following three tasks: 1. Input: Prompt the user to enter a character string. Read the character string from your computer through the Arduino's serial interface. 2. Processing: Convert lowercase characters to uppercase and uppercase characters to lowercase, and 3. Output: Return the processed string through the serial output and display it on your computer screen. Example: If the input character string is, “Here I am”,...

  • Using the Arduino IDE, write a program for an Arduino board that will perform the following three...

    Using the Arduino IDE, write a program for an Arduino board that will perform the following three tasks: 1. Input: Prompt the user to enter a character string. Read the character string from your computer through the Arduino's serial interface. 2. Processing: Convert lowercase characters to uppercase and uppercase characters to lowercase, and 3. Output: Return the processed string through the serial output and display it on your computer screen. Example: If the input character string is, “Here I am”,...

  • in arduino Improved Sensor Readings a. The name of this program will be lab3p2. Copy the...

    in arduino Improved Sensor Readings a. The name of this program will be lab3p2. Copy the program from lab2p1, as that is the most similar to this program. b. Readings from sensors are prone to noise. A typical way to reduce the noise and hence, improve the accuracy of a reading is to take multiple readings and average! From statistics we learn that the accuracy improves with VN, where N is the number of reading. c. If you want to...

  • use Python and please comments every step. [25] 6. Write a program that reads from standard...

    use Python and please comments every step. [25] 6. Write a program that reads from standard input, two times in military format and prints the number of hours and minutes between the two times. Assume that the second time is always ahead of the first time. You should avoid using conditional statement (if-else) for this program. Your program must query the user for the two times and output the difference based on the two sample runs given below. Please enter...

  • Looking for help to create the arduino program for this in C. dont need the breadboard...

    Looking for help to create the arduino program for this in C. dont need the breadboard information just the arduino code to run it all, and as an expection to handle a case where a letter not 'g' or 's' to send output invalid response and not stop the exection of the blinking based You are to create a new application that will execute on your Arduino platform upon the Blink example that is available in the Arduino Examples folder...

  • Write an Arduino code to read the current temperature using the LM35 temperature sensor. The code...

    Write an Arduino code to read the current temperature using the LM35 temperature sensor. The code should include the following if the temperature is more than 45 "C: • Turn ON red LED, and after 1 second turn ON the yellow LED, and after another 2 seconds tum On the Green LED. One second later the three LEDS should start blinking (all LEDs OFF for 0.5 seconds, then all LEDS ON for 1 minute), and turn OFF all LEDs after...

  • Step 1. Build an Arduino circuit that has a piezo buzzer. Step 2. Create you very own function. T...

    using C++ Step 1. Build an Arduino circuit that has a piezo buzzer. Step 2. Create you very own function. The function should a sound (C musical note at 523 H2) consisting of N short bursts (around 200 milliseconds) followed by one long pause (2 seconds). N is an input to the function and can be any integer, 1,2, 3...). Name this function sound Alert. Step 3. Write a complete Arduino sketch (program). The program should ask for N from...

  • Write a program that prompts the user for their quarterly water bill for the last four...

    Write a program that prompts the user for their quarterly water bill for the last four quarters. The program should find and output their average monthly water bill. If the average bill exceeds $75, the output should include a message indicating that too much water is being used. If the average bill is at least $25 but no more than $75, the output should indicate that a typical amount of water is being used. Finally, if the average bill is...

  • Please write a simple Slideshow program in Java GUI. There are three buttons in the bottom...

    Please write a simple Slideshow program in Java GUI. There are three buttons in the bottom Panel. Open: you can choose multiple pictures. Start: starts the slideshow and change the picture in two seconds. Stop: you can stop the slideshow.

  • How to write these steps in ladder diagram using PLC 1-Stop all motions 2-The sequence shall...

    How to write these steps in ladder diagram using PLC 1-Stop all motions 2-The sequence shall be repeated when you re-press the start button after completion of the sequence 3- If the emergency stop is pressed at any time, stop all motions immediately.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT