Skip to content

Instantly share code, notes, and snippets.

@kingcoyote
Created August 20, 2014 20:17
Show Gist options
  • Save kingcoyote/e04302e652d67be786c8 to your computer and use it in GitHub Desktop.
Save kingcoyote/e04302e652d67be786c8 to your computer and use it in GitHub Desktop.
#include <xc.h>
#include <pic18.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ws2812.h"
// subsystem structs
ws2812_ptr led;
void main() {
led.r = 0;
led.g = 255;
led.b = 255;
while(1) {
CLRWDT();
// timing on the WS2812B is very precise. turn off interrupts before talking
GIE = 0; while (GIE);
ws2812_send(&led);
GIE = 1; while (!GIE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment