Skip to content

No pwm output on micro:bit pin 8 #374

Closed
@mattybigback

Description

@mattybigback
  • Arduino board: BBC Micro:bit v1

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.2.1 (Also using VS Code with the Arduino extension

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

#include <Adafruit_NeoPixel.h>

const int numPixels = 24;
const int pixelPin = 8;

Adafruit_NeoPixel ring = Adafruit_NeoPixel(numPixels, pixelPin);
uint32_t foreground = ring.Color(0x00, 0x00, 0xFF); // r, g, b - blue
uint32_t background = ring.Color(0x10, 0x10, 0x10); // dim white

void setup() {
  pinMode(pixelPin, OUTPUT);
  ring.begin(); // start the NeoPixel display
}

void loop() {
  // blue dot circles around a white background (for PixelRing 24)
  for (int i = 0; i < numPixels; i++) {
    ring.setPixelColor(i, foreground); // set pixel i to foreground
    ring.show();                       // actually display it
    delay(50);                         // milliseconds 
    ring.setPixelColor(i, background); // set pixel to background before moving on
    ring.show(); 
  }
}

Using pin 8 as the LED pin does not work. There's no output at all on the pin. Changing to pin 2 results in a working sketch. Pin 8 is definitely capable of pwm (tested with the below sketch).

const int LED = 8;

void setup() {   
  pinMode(LED, OUTPUT);   
}

void loop(){
  analogWrite(LED, 128);
  delay(1000);
  analogWrite(LED, 1);
  delay(1000);
}

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