Skip to content

PWM wrapper for hardware or software PWM #92

@michaeljanich

Description

@michaeljanich

My code is full of

    if (pin == 1 || pin == 23) {
	wpi.pinMode(pin, wpi.PWM_OUTPUT); // hardware PWM
	wpi.digitalWrite(pin, value);
    } else {
	wpi.softPwmCreate(pin, 0, value / 10.23);
    }

these if's to distinguish between software PWM and hardware PWM pins.

Is there a better solution? Like an automatic switch inside the library?

THANKS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions