hello everyone, I am new to all of this and have been creating a fire-fighting robot for my first-semester college expo project. I have been able to get the flame sensor to correspond with the wheel motors but have been having issues with the water pump. My professor had recommended using the servo1 port for the water pump but since the pump only has a live and ground wire I have no way of connecting it to pin 10 (which is the pin for servo1). Does anyone know how to fix this issue? I'm using the Arduino Uno R3 with the Eelegoo smartcar-shield-V1.1 on top of that. I also have an Ultrasonic sensor attached to it to help the robot detect its surroundings, I started adding code for that but didn't finish it so if anyone understands that portion as well that would be super helpful.
Thanks - Drew
this is my code
`#include <arduino.h>
#define IR 11 //forward sensor
int pos = 0;
boolean fire = false;
int Obstacle;
#define PIN_Motor_STBY 3
#define PIN_Motor_PWMA 5
#define PIN_Motor_PWMB 6
#define PIN_Motor_AIN_1 7
#define PIN_Motor_BIN_1 8
#define pump 10
// Motor Speed Presets
// PWM setting can be from 0 to 255
;int speed_Zero = 0; // PWM = 0% Duty Cycle
int speed_Min = 64; // PWM = 25% Duty Cycle
int speed_MidL = 127; // PWM = 50% Duty Cycle
int speed_MidH = 191; // PWM = 75% Duty Cycle
int speed_Max = 255; // PWM = 100% Duty Cycle
void setup() {
// put your setup code here, to run once:
pinMode(IR, INPUT);
Serial.begin(9600);
pinMode(pump, OUTPUT);
pinMode(PIN_Motor_PWMA,OUTPUT); // before using io pin, pin mode must be set first
pinMode(PIN_Motor_AIN_1,OUTPUT);
pinMode(PIN_Motor_PWMB,OUTPUT);
pinMode(PIN_Motor_BIN_1,OUTPUT);
pinMode(PIN_Motor_STBY,OUTPUT);
}
void put_off_fire(){
delay (500);
digitalWrite(PIN_Motor_STBY,HIGH);
digitalWrite(PIN_Motor_AIN_1,HIGH);
digitalWrite(PIN_Motor_BIN_1,HIGH);
digitalWrite(PIN_Motor_PWMA, HIGH);
digitalWrite(PIN_Motor_PWMB, HIGH);
digitalWrite(pump, HIGH);
delay(500);
}
void loop() {
// put your main code here, to run repeatedly:
//Do not move the robot
Obstacle = digitalRead(IR);
if(Obstacle == LOW) {
fire = false;
Serial.println("no fire");
Serial.println("pump off");
}
else {
fire = true;
Serial.println("fire");
Serial.println("pump on");
digitalWrite(pump, true );
}
if (fire==false) //If Fire not detected keep moving
{
digitalWrite(pump, LOW);
digitalWrite(PIN_Motor_STBY,HIGH); // Turn ON
digitalWrite(PIN_Motor_AIN_1,HIGH); //Motor A ON
digitalWrite(PIN_Motor_BIN_1,HIGH); //Motor B ON
// Motor A and B have same speed setting
// A = right wheels; B = left wheels
// speed_Min = 64; // PWM = 25% Duty Cycle
analogWrite(PIN_Motor_PWMA,speed_Min); //Speed Motor A
analogWrite(PIN_Motor_PWMB,speed_Min); //Speed Motor B
delay (500); // delay 2000 milli seconds
analogWrite(PIN_Motor_PWMA,0); //Speed Motor A
analogWrite(PIN_Motor_PWMB,0); //Speed Motor B
digitalWrite(PIN_Motor_STBY,LOW); // Turn Motor off
//digitalWrite(PIN_Motor_AIN_1,LOW); //Motor A Backward
//digitalWrite(PIN_Motor_BIN_1,LOW); //Motor B Backward
delay (100); // delay 2000 milli seconds
}
else ( fire==true);//If Fire is straight ahead
{
//Dont move the robot
digitalWrite(PIN_Motor_STBY,LOW); // Turn OFF
digitalWrite(PIN_Motor_AIN_1,LOW); //Motor A
digitalWrite(PIN_Motor_BIN_1,LOW); //Motor B
digitalWrite(pump, HIGH);
// Motor A and B have same speed setting
// A = right wheels; B = left wheels
// speed_Min = 64; // PWM = 25% Duty Cycle
analogWrite(PIN_Motor_PWMA,speed_MidL); //Speed Motor A
analogWrite(PIN_Motor_PWMB,speed_MidL); //Speed Motor B
}
delay(100); //Slow down the speed of robot
}`



