Some fine tuning for 12V
This commit is contained in:
@@ -38,7 +38,7 @@ int enable1Pin = 14;
|
|||||||
const int freq = 30000;
|
const int freq = 30000;
|
||||||
const int pwmChannel = 0;
|
const int pwmChannel = 0;
|
||||||
const int resolution = 8;
|
const int resolution = 8;
|
||||||
int dutyCycle = 200;
|
int motorSpeed = 220; // motor speed, max 355
|
||||||
|
|
||||||
WebServer server(80);
|
WebServer server(80);
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ void setup(void) {
|
|||||||
// attach the channel to the GPIO to be controlled
|
// attach the channel to the GPIO to be controlled
|
||||||
ledcAttachPin(enable1Pin, pwmChannel);
|
ledcAttachPin(enable1Pin, pwmChannel);
|
||||||
|
|
||||||
ledcWrite(pwmChannel, 255);
|
ledcWrite(pwmChannel, motorSpeed);
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ void setup(void) {
|
|||||||
Serial.println("Moving Forward");
|
Serial.println("Moving Forward");
|
||||||
digitalWrite(motor1Pin1, LOW);
|
digitalWrite(motor1Pin1, LOW);
|
||||||
digitalWrite(motor1Pin2, HIGH);
|
digitalWrite(motor1Pin2, HIGH);
|
||||||
delay(3000);
|
delay(1000);
|
||||||
// Stop the DC motor
|
// Stop the DC motor
|
||||||
digitalWrite(motor1Pin2, LOW);
|
digitalWrite(motor1Pin2, LOW);
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ void setup(void) {
|
|||||||
Serial.println("Moving Backward");
|
Serial.println("Moving Backward");
|
||||||
digitalWrite(motor1Pin1, HIGH);
|
digitalWrite(motor1Pin1, HIGH);
|
||||||
digitalWrite(motor1Pin2, LOW);
|
digitalWrite(motor1Pin2, LOW);
|
||||||
delay(3000);
|
delay(1000);
|
||||||
// Stop the DC motor
|
// Stop the DC motor
|
||||||
digitalWrite(motor1Pin1, LOW);
|
digitalWrite(motor1Pin1, LOW);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user