Hi,
I'm very new to this and I am very aware my programming, soldering and wiring is a mess. I am trying to program a motor to spin as a part of a small Wind tunnel project. Unfortunately I broke the legs off my potentiometer, so I decided to use push to make buttons instead. I don't think I have correctly grounded these as when my finger hovers over Button Up the "Power" quickly goes to max. Also when I connect the battery the ESC and motor produces beeps every 3 seconds until I press the up or down button, but the motor does not start to spin. When I press the stop button the beeping continues. I am using a 4S 1500mAh 120C battery. I looked at a lot of online websites, but I've just been confused on what is wrong.
Thank you for any help!!!
Thanks for the pictures but......
Read this link and sharpen Your post one step or two: How to get the best out of this forum - Using Arduino / Project Guidance - Arduino Forum
Schematics showing how the buttons are wired is number one.
Thank you for the link, here’s the extra info:
The hardware I am using:
Arduino UNO based microcontroller
1k resistors
Push to make buttons
30A ESC XXD
Dx2205 2300kv drone motors
4s 1500 mAh LiPo battery
#include <Servo.h>
Servo ESC;
byte escPin = 9;
int percentPower = 0;
const int buttonStopPin = 11;
const int button1Pin = 12;
const int button2Pin = 13;
int buttonStopState = 0;
int button1State = 0;
int button2State = 0;
int Value1;
int pmwVal;
void setup() {
Serial.begin(9600);
pinMode(buttonStopState, INPUT);
pinMode(button1Pin, INPUT);
pinMode(button2Pin, INPUT);
ESC.attach(escPin);
ESC.writeMicroseconds(1500);
delayMicroseconds(7000);
}
void loop() {
buttonStopState = digitalRead(buttonStopPin);
button1State = digitalRead(button1Pin);
button2State = digitalRead(button2Pin);
if (buttonStopState == HIGH) {
percentPower = 0;
}
else if (button1State == HIGH and percentPower < 96) {
percentPower = percentPower + 5;
}
else if (button2State == HIGH and percentPower > 4) {
percentPower = percentPower - 5;
}
int Value1 = map(percentPower, -100, 100, 1100, 1900);
int pwmVal = map(percentPower, -100, 100, 1100, 1900);
Serial.print("Stop State:");
Serial.print(buttonStopState);
Serial.print(" Up:");
Serial.print(button1State);
Serial.print(" Down:");
Serial.print(button2State);
Serial.print(" Power:");
Serial.print(percentPower);
Serial.print(" PMW signal:");
Serial.println(Value1);
ESC.writeMicroseconds(pwmVal);
}