arduino / arduino/ArduinoCore-samd
Bug when doing analogWrite() then digitalWrite()
- Dominant language
- C
- Stars
- 502
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
there is a bug when doing analogWrite() then digitalWrite() on a pwm pin. The pin will kept being configured as a pwm output and the digitalWrite() will have no effect.
In the following snippet, the Built-in LED will kept being controlled by PWM.
```
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
analogWrite(LED_BUILTIN, 20);
digitalWrite(LED_BUILTIN, HIGH);
}
void loop() {}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the SAMD21 implementations of analogWrite() and digitalWrite() for PWM-capable pins, using the provided sketch as the reproducer. Check how pin output mode is restored after analogWrite(); done means a subsequent digitalWrite(LED_BUILTIN, HIGH) takes effect instead of leaving the pin under PWM control.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100