I need a sketch, to a scrubber
1 button 3 opto to turn on the water, opto 1 and opto 2 and opto 3
1 button to start opto pump
1 button start opto hower
You have our permission.
Here you go:
/*
I need a sketch, to a scrubber
1 button 3 opto to turn on the water, opto 1 and opto 2 and opto 3
1 button to start opto pump
1 button start opto hower
*/
// Input Pins
const int WaterButtonPin = 3;
const int PumpButtonPin = 4;
const int HowerButtonPin = 5;
// Output Pins
const int WaterOpto1Pin = 6;
const int WaterOpto2Pin = 7;
const int WaterOpto3Pin = 8;
const int PumpOptoPin = 9;
const int HowerOptoPin = 10;
void setup() {
// Input Pins
pinMode(WaterButtonPin, INPUT_PULLUP);
pinMode(PumpButtonPin, INPUT_PULLUP);
pinMode(HowerButtonPin, INPUT_PULLUP);
// Output Pins
digitalWrite(WaterOpto1Pin, LOW);
pinMode(WaterOpto1Pin, OUTPUT);
digitalWrite(WaterOpto2Pin, LOW);
pinMode(WaterOpto2Pin, OUTPUT);
digitalWrite(WaterOpto3Pin, LOW);
pinMode(WaterOpto3Pin, OUTPUT);
digitalWrite(PumpOptoPin, LOW);
pinMode(PumpOptoPin, OUTPUT);
digitalWrite(HowerOptoPin, LOW);
pinMode(HowerOptoPin, OUTPUT);
}
void loop() {
if (!digitalRead(WaterButtonPin)) {
digitalWrite(WaterOpto1Pin, HIGH);
digitalWrite(WaterOpto2Pin, HIGH);
digitalWrite(WaterOpto3Pin, HIGH);
}
if (!digitalRead(PumpButtonPin)) {
digitalWrite(PumpOptoPin, HIGH);
}
if (!digitalRead(HowerButtonPin)) {
digitalWrite(HowerOptoPin, HIGH);
}
}