- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 287
Open
Labels
Description
Looks the analogWrite() "pwm" signal on the nRF51 (now PWM hardware, so uses a timer instead) does not stop operation even after pinMode() and digitalWrite() has been applied to the same pin.
Simple sketch for testing:
const int analogOutPin = 9;
void setup() {
  // put your setup code here, to run once:
  
}
void loop() {
  // Increase PWM until maximun value, takes around a couple of seconds
  for (byte i = 0; i<255; i++) {
    analogWrite(analogOutPin, i);
    delay(10);
  }
  // Toggle the same pin high and low a couple of times
  delay(1000);
  pinMode(analogOutPin, OUTPUT);
  digitalWrite(analogOutPin, HIGH);
  delay(1000);
  digitalWrite(analogOutPin, LOW);
  delay(1000);
  digitalWrite(analogOutPin, HIGH);
  delay(1000);
  digitalWrite(analogOutPin, LOW);
  delay(1000);
}
Expected behaviour:
- PWM signal increasing from minimum to maximum
- Same pin signal toggled high and low a couple of times
- loop iterates
Recorded behaviour:
- PWM signal increasing from minimum to maximum
- PWM signal stays at maximum value
- loop iterates