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:
+5
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user