From 282231ea2829d286ae3432022d56a6c4f573ed33 Mon Sep 17 00:00:00 2001 From: Abel Tim Date: Sun, 8 Feb 2026 10:52:55 +0100 Subject: SOFTPWM Multi-line description of commit, feel free to be detailed. [Issue: X] --- .../debug/motors/basic-motor-dr/basic-motor-dr.ino | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 code/debug/motors/basic-motor-dr/basic-motor-dr.ino (limited to 'code/debug/motors/basic-motor-dr/basic-motor-dr.ino') diff --git a/code/debug/motors/basic-motor-dr/basic-motor-dr.ino b/code/debug/motors/basic-motor-dr/basic-motor-dr.ino new file mode 100755 index 0000000..b7f3b36 --- /dev/null +++ b/code/debug/motors/basic-motor-dr/basic-motor-dr.ino @@ -0,0 +1,32 @@ +int m1enA = 6; +int m1enB = 5; +int m1pwm1 = 4; +int m1pwm2 = 3; +int m1encoA = 32; +int m1encoB = 31; + +void setup() { + Serial.begin(9600); + + pinMode(m1enA, OUTPUT); + pinMode(m1enB, OUTPUT); + pinMode(m1pwm1, OUTPUT); + pinMode(m1pwm2, OUTPUT); + + pinMode(m1pwm1, INPUT); + pinMode(m1pwm2, INPUT); + +} + +void loop() { + digitalWrite(m1enA, HIGH); + digitalWrite(m1enB, LOW); + digitalWrite(m1pwm1, HIGH); + digitalWrite(m1pwm2, LOW); + delay(500); + digitalWrite(m1enA, HIGH); + digitalWrite(m1enB, LOW); + digitalWrite(m1pwm1, LOW); + digitalWrite(m1pwm2, HIGH); + delay(500); +} -- cgit v1.2.3