Add PWM motor control and refactor engine update

Introduce ENA pins for both motors and implement rpmToPwm and setMotor.
Replace extensive Serial debug prints with concise motor‑drive logic in
Engine::update. Consolidate sonar pins into a single TRIG_AND_ECHO_PIN.
Update pinMode calls in the sketch to configure the new ENA pins.
This commit is contained in:
2026-06-16 23:35:23 +02:00
parent 17f888a11c
commit 23d5003788
4 changed files with 34 additions and 50 deletions
+5 -1
View File
@@ -22,6 +22,10 @@ void setup() {
pinMode(IN_1, OUTPUT);
pinMode(IN_2, OUTPUT);
pinMode(ENA_1, OUTPUT);
pinMode(IN_3, OUTPUT);
pinMode(IN_4, OUTPUT);
pinMode(ENA_2, OUTPUT);
rfid.begin();
display.begin(LCD_COLS, LCD_ROWS);
@@ -38,7 +42,7 @@ void loop() {
carEnabled = !carEnabled;
Serial.print("Auto działa: ");
Serial.println(carEnabled);
display.startOrEnd(carEnabled);0
display.startOrEnd(carEnabled);
};
if (carEnabled) {