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 causes servo to twitch #619

tomchambers2 opened this Issue Jun 27, 2018 · 2 comments


None yet
2 participants

tomchambers2 commented Jun 27, 2018

When running every 50 miliseconds (by measuring the delta rather than with a delay) and having a servo attached without the servo being sent any code, the servo twitches. This only happens when .show() is fired.

#include <Servo.h>
#include <FastLED.h>

#define LED_TYPE    WS2812B
#define LED_STRIP_PIN     6
#define NUM_LEDS    100
#define LED_UPDATE_TIME 50

int lastLedUpdate = 0;


Servo servo;

setup() {
  FastLED.addLeds<LED_TYPE, LED_STRIP_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);;  

loop() {
  if (millis() - lastLedUpdate < LED_UPDATE_TIME) return;

  lastLedUpdate = millis();

  for (int i = 0; i <= NUM_LEDS; i++) {
    leds[i] = CRGB::Red;

This comment has been minimized.


focalintent commented Jun 27, 2018

Unfortunately, servos are driven by interrupts which get disabled while writing out ws2812 data. Either switch to an led chipset that doesn’t require disabling interrupts like the apa102 or switch to a platform that allows interrupts to run while writing out led data like the teensy 3.x.


This comment has been minimized.


focalintent commented Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment