Shop OBEX P1 Docs P2 Docs Learn Events
Problem with the Badge WX LED's — Parallax Forums

Problem with the Badge WX LED's

Dear all,

I am quite new to BlocklyProp and am programming the Badge WX. When I try to address LED 1 to blue, all four of the LED's are switched on bright white. I am able to address LED's 2 ,3 and 4 in the expected way.

The code is below and attached. Any help much appreciated
// ------ Libraries and Definitions ------
#include "simpletools.h"
#include "badgewxtools.h"
#include "ws2812.h"
#define RGB_COUNT 4

// ------ Global Variables and Objects ------
ws2812 *ws2812b;
int RGBleds[4];



// ------ Main Program ------
int main() {
  badge_setup();
  ws2812b = ws2812b_open();
  // Allow the Badge WX to be programmed over WiFi
  high(17);
  RGBleds[constrainInt(1, 1, RGB_COUNT) - 1] = 0x0000FF;
  ws2812_set(ws2812b, RGB_PIN, RGBleds, RGB_COUNT);

}
430 x 203 - 15K

Comments

  • Works fine on my Badge.

    Maybe something wrong with LED 1 on your badge.

    Mike
  • I experienced similar RGB addressing frustrations where I couldn't light the 4th light on my BlocklyProp Badge WX. I think it stemmed from me having one offending "RGB-LED set" blocks with an LED number of 0. I was thinking 0,1,2,3 not 1,2,3,4. It seemed like the compiler did some min max math and limited the last LED based on starting at 0.
Sign In or Register to comment.