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] --- code/debug/motors/pwm/.idea/.gitignore | 10 ++++ code/debug/motors/pwm/.idea/editor.xml | 101 ++++++++++++++++++++++++++++++++ code/debug/motors/pwm/.idea/modules.xml | 8 +++ code/debug/motors/pwm/.idea/pwm.iml | 2 + code/debug/motors/pwm/.idea/vcs.xml | 6 ++ code/debug/motors/pwm/pwm.ino | 38 ++++++++++++ 6 files changed, 165 insertions(+) create mode 100644 code/debug/motors/pwm/.idea/.gitignore create mode 100644 code/debug/motors/pwm/.idea/editor.xml create mode 100644 code/debug/motors/pwm/.idea/modules.xml create mode 100644 code/debug/motors/pwm/.idea/pwm.iml create mode 100644 code/debug/motors/pwm/.idea/vcs.xml create mode 100755 code/debug/motors/pwm/pwm.ino (limited to 'code/debug/motors/pwm') diff --git a/code/debug/motors/pwm/.idea/.gitignore b/code/debug/motors/pwm/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/code/debug/motors/pwm/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/code/debug/motors/pwm/.idea/editor.xml b/code/debug/motors/pwm/.idea/editor.xml new file mode 100644 index 0000000..ca29dcc --- /dev/null +++ b/code/debug/motors/pwm/.idea/editor.xml @@ -0,0 +1,101 @@ + + + + + \ No newline at end of file diff --git a/code/debug/motors/pwm/.idea/modules.xml b/code/debug/motors/pwm/.idea/modules.xml new file mode 100644 index 0000000..9ddc8bc --- /dev/null +++ b/code/debug/motors/pwm/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/code/debug/motors/pwm/.idea/pwm.iml b/code/debug/motors/pwm/.idea/pwm.iml new file mode 100644 index 0000000..4c94235 --- /dev/null +++ b/code/debug/motors/pwm/.idea/pwm.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/code/debug/motors/pwm/.idea/vcs.xml b/code/debug/motors/pwm/.idea/vcs.xml new file mode 100644 index 0000000..4fce1d8 --- /dev/null +++ b/code/debug/motors/pwm/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/code/debug/motors/pwm/pwm.ino b/code/debug/motors/pwm/pwm.ino new file mode 100755 index 0000000..9743b09 --- /dev/null +++ b/code/debug/motors/pwm/pwm.ino @@ -0,0 +1,38 @@ +#include + +int m1enA = LED_BUILTIN; +int m1enB = 5; +int m1pwm1 = 4; +int m1pwm2 = 3; +int m1encoA = 32; +int m1encoB = 31; + +void setup() { + Serial.begin(9600); + + SoftPWMBegin(); + SoftPWMSetPolarity(m1enA, 0); + SoftPWMSet(m1enA, 0); + + pinMode(m1enB, OUTPUT); + pinMode(m1pwm1, OUTPUT); + pinMode(m1pwm2, OUTPUT); + + pinMode(m1pwm1, INPUT); + pinMode(m1pwm2, INPUT); + +} + +void loop() { + SoftPWMSet(m1enA, 50); + digitalWrite(m1enB, LOW); + digitalWrite(m1pwm1, HIGH); + digitalWrite(m1pwm2, LOW); + delay(500); + SoftPWMSet(m1enA, 255); + digitalWrite(m1enA, HIGH); + digitalWrite(m1enB, LOW); + digitalWrite(m1pwm1, LOW); + digitalWrite(m1pwm2, HIGH); + delay(500); +} -- cgit v1.2.3