Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No pwm output on micro:bit pin 8 #374

Open
mattybigback opened this issue Nov 23, 2023 · 0 comments
Open

No pwm output on micro:bit pin 8 #374

mattybigback opened this issue Nov 23, 2023 · 0 comments

Comments

@mattybigback
Copy link

  • 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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant