Skip to content

Clarify DCMotor sample pin numbering and H-bridge wiring#2583

Merged
krwq merged 4 commits into
mainfrom
copilot/improve-dcmotor-example
Jul 23, 2026
Merged

Clarify DCMotor sample pin numbering and H-bridge wiring#2583
krwq merged 4 commits into
mainfrom
copilot/improve-dcmotor-example

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The DCMotor sample uses DCMotor.Create(6, 27, 22) but never documents that these are BCM (logical) GPIO numbers, nor which argument maps to which H-bridge input — making it impossible to wire the H-bridge to match the code. The maintainer confirmed the pins are BCM numbering.

Documentation/comment-only change; no motor control logic touched.

Changes

  • README.md: Added a Wiring section stating pins use BCM numbering (with a link to the Raspberry Pi pinout), plus a table mapping each Create argument to its BCM pin and H-bridge input, and the remaining wiring notes as a bullet list. Kept the embedded code block in sync with the sample.
  • samples/Program.cs: Added comments noting BCM numbering and the pin→H-bridge mapping, pointing to the README.

Pin mapping (3-pin mode)

Create argument BCM pin H-bridge input
speedControlPin 6 ENA (enable/PWM)
directionPin 27 IN1
otherDirectionPin 22 IN2

Note: the Fritzing diagram (dcmotor_bb.png) was not regenerated; the docs now explicitly state the numbering scheme so the code and diagram can be reconciled by a reviewer with the hardware.

Copilot AI linked an issue Jul 1, 2026 that may be closed by this pull request
@dotnet-policy-service dotnet-policy-service Bot added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Jul 1, 2026
Copilot AI changed the title [WIP] Improve clarity on DCMotor example for H Bridge connections Clarify DCMotor sample pin numbering and H-bridge wiring Jul 1, 2026
Copilot AI requested a review from raffaeler July 1, 2026 14:20
Comment thread src/devices/DCMotor/README.md Outdated
Copilot AI requested a review from raffaeler July 1, 2026 14:47
@raffaeler

Copy link
Copy Markdown
Contributor

I approved, but don´t know this piece of hardware.
Is there anyone that knows if the mappings are good?

@raffaeler
raffaeler marked this pull request as ready for review July 1, 2026 15:11
Copilot AI review requested due to automatic review settings July 1, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Clarifies the DCMotor sample’s GPIO numbering scheme and documents how the DCMotor.Create(6, 27, 22) arguments map to typical H-bridge control inputs, so readers can wire hardware to match the sample.

Changes:

  • Added BCM/GPIO numbering guidance and a pin-to-H-bridge mapping comment in the sample program.
  • Added a new Wiring section in the DCMotor README with a mapping table and wiring notes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/devices/DCMotor/samples/Program.cs Adds comments explaining BCM numbering and the 3-pin wiring mapping.
src/devices/DCMotor/README.md Adds a Wiring section with BCM numbering guidance, mapping table, and wiring checklist.

Comment thread src/devices/DCMotor/samples/Program.cs
Comment thread src/devices/DCMotor/README.md
Comment thread src/devices/DCMotor/README.md
@krwq
krwq merged commit 0b305d7 into main Jul 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DCMotor example improvement

4 participants