Conversation
Core Implementation: • Complete Stepper class supporting 4-pin stepper motors (28BYJ-48 + ULN2003) • Three step sequences: wave, full, half-step for different torque/smoothness needs • Position tracking with step counting and angle calculation • Configurable steps-per-revolution and step delays for different motors API Design Philosophy - Four Complementary Approaches: 1. DEFAULT DIRECTION (Simplest) • step(10) - Uses default clockwise direction • Minimizes cognitive load for basic use cases 2. CONVENIENCE METHODS (Explicit Intent) • step_clockwise(10), step_counterclockwise(10) • rotate_clockwise(90), rotate_counterclockwise(90) • revolve_clockwise(2), revolve_counterclockwise(2) • Short aliases: step_cw(), rotate_ccw(), revolve_cw() • Clear, readable, self-documenting code 3. PARAMETERIZED METHODS (Flexible Control) • step(10, direction='cw'|'ccw'|1|-1) • rotate(90, direction='clockwise'|'counter-clockwise') • revolution(2, direction=1|-1) • Supports both string and numeric direction parameters • Flexible _normalize_direction() handles multiple formats 4. ALIAS SUPPORT (Compatibility) • revolve() as alias for revolution() • StepperMotor as backward-compatible class alias • Maintains consistency with existing picozero patterns Technical Features: • Polymorphic direction parameters (string/numeric) with validation • Real-time speed control via step_delay property • Position reset capability for homing/calibration • Proper resource management with off() and close() methods • Comprehensive error handling with descriptive messages Testing Strategy: • Validates all API approaches for consistency • Covers edge cases and error conditions Documentation: • Added Stepper class to API documentation • Exported in __init__.py for public access • Comprehensive docstrings with parameter details • Usage examples showing all API patterns
- Add MotionSensor section to recipes.rst (missing from previous merge) - Add Stepper section to recipes.rst with comprehensive examples - Update changelog.rst with v0.5.0 entries for both classes - Organize motor sections together for better flow
Core Implementation: • Complete Stepper class supporting 4-pin stepper motors (28BYJ-48 + ULN2003) • Three step sequences: wave, full, half-step for different torque/smoothness needs • Position tracking with step counting and angle calculation • Configurable steps-per-revolution and step delays for different motors API Design Philosophy - Four Complementary Approaches: 1. DEFAULT DIRECTION (Simplest) • step(10) - Uses default clockwise direction • Minimizes cognitive load for basic use cases 2. CONVENIENCE METHODS (Explicit Intent) • step_clockwise(10), step_counterclockwise(10) • rotate_clockwise(90), rotate_counterclockwise(90) • revolve_clockwise(2), revolve_counterclockwise(2) • Short aliases: step_cw(), rotate_ccw(), revolve_cw() • Clear, readable, self-documenting code 3. PARAMETERIZED METHODS (Flexible Control) • step(10, direction='cw'|'ccw'|1|-1) • rotate(90, direction='clockwise'|'counter-clockwise') • revolution(2, direction=1|-1) • Supports both string and numeric direction parameters • Flexible _normalize_direction() handles multiple formats 4. ALIAS SUPPORT (Compatibility) • revolve() as alias for revolution() • StepperMotor as backward-compatible class alias • Maintains consistency with existing picozero patterns Technical Features: • Polymorphic direction parameters (string/numeric) with validation • Real-time speed control via step_delay property • Position reset capability for homing/calibration • Proper resource management with off() and close() methods • Comprehensive error handling with descriptive messages Testing Strategy: • Validates all API approaches for consistency • Covers edge cases and error conditions Documentation: • Added Stepper class to API documentation • Exported in __init__.py for public access • Comprehensive docstrings with parameter details • Usage examples showing all API patterns
- Add MotionSensor section to recipes.rst (missing from previous merge) - Add Stepper section to recipes.rst with comprehensive examples - Update changelog.rst with v0.5.0 entries for both classes - Organize motor sections together for better flow
After rebase onto dev branch that includes MotionSensor docs from PR #131, remove the duplicate MotionSensor section that was incorrectly positioned after temperature sensor. MotionSensor documentation now correctly appears only once after Buttons section, maintaining proper input device grouping.
…--manual-install 118 documentation manual install
Use debounced last_state instead of re-reading pin after bounce_time wait. The bounce_time loop stabilizes the value in last_state, but the code was re-reading the pin which could return a transient/unstable value, causing valid state changes to be missed. This fixes sound sensors and other fast-pulsing inputs with bounce_time enabled. Fixes issue: Sound Sensor with bounce_time=1 not detecting signals
Co-authored-by: pjbRPF <104009652+pjbRPF@users.noreply.github.com>
Co-authored-by: pjbRPF <104009652+pjbRPF@users.noreply.github.com>
Co-authored-by: pjbRPF <104009652+pjbRPF@users.noreply.github.com>
Co-authored-by: pjbRPF <104009652+pjbRPF@users.noreply.github.com>
…ation/picozero into feature/stepper
…st_picozero.py - Changed pin assignments across multiple PWM tests to avoid channel conflicts (test_pwm_output_device_default_values: 1→14, test_pwm_output_device_alt_values: 1→5, test_pwm_output_device_blink: 1→6, test_pwm_output_device_pulse: 1→7, test_motor_default_values: 1,2→8,9, test_robot: 1,2,3,4→10,11,12,13, test_LED_factory: 1→20,21) - Updated test_pwm_output_device_alt_values to accept both duty values (9999 or 10000) for compatibility with MicroPython versions before and after v1.20 - Ensures PWM hardware channels are not reused between sequential tests
Patch/tests_fix
…and_distance_sensor_tests Add comprehensive tests for Speaker and DistanceSensor classes
Add Stepper motor class
…-time-sound-sensor Fix bounce_time debouncing for brief signals in DigitalInputDevice
Feature/TouchSensor
MarcScott
approved these changes
Nov 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.