suche sm16716 code für 50LEDs (adalight)

Hi,
hab mir ein 50LEDs Strang bestellt um mir adalight an dem TV zu machen,
jedoch hab ich nicht die WS2801 Chip version bekommen sondern die sm16716
da ich aber vom code schreiben und ändern zero plan habe bin ich im mom zimlich aufgeschmissen.

hab rausgefunden das man dafür den fastspi code nutzen kann jedoch lauft nix bei mir.

// Uncomment this line if you have any interrupts that are changing pins - this causes the library to be a little bit more cautious
// #define FAST_SPI_INTERRUPTS_WRITE_PINS 1

// Uncomment this line to force always using software, instead of hardware, SPI (why?)
// #define FORCE_SOFTWARE_SPI 1

// Uncomment this line if you want to talk to DMX controllers
// #define FASTSPI_USE_DMX_SIMPLE 1

#include "FastSPI_LED2.h"


////////////////////////////////////////////////////////////////////////////////////////////////////
//
// test code
//
//////////////////////////////////////////////////

#define NUM_LEDS 150

struct CRGB leds[NUM_LEDS];

void setup() {
	// sanity check delay - allows reprogramming if accidently blowing power w/leds
   	delay(2000);

   	// For safety (to prevent too high of a power draw), the test case defaults to
   	// setting brightness to 25% brightness
   	LEDS.setBrightness(64);

   	// LEDS.addLeds<WS2811, 13>(leds, NUM_LEDS);
   	// LEDS.addLeds<TM1809, 13>(leds, NUM_LEDS);
   	// LEDS.addLeds<UCS1903, 13>(leds, NUM_LEDS);
   	// LEDS.addLeds<TM1803, 13>(leds, NUM_LEDS);

   	LEDS.addLeds<LPD8806>(leds, NUM_LEDS)->clearLeds(300);
	// LEDS.addLeds<WS2801>(leds, NUM_LEDS);
   	// LEDS.addLeds<SM16716>(leds, NUM_LEDS);

   	// LEDS.addLeds<WS2811, 11>(leds, NUM_LEDS);

	// Put ws2801 strip on the hardware SPI pins with a BGR ordering of rgb and limited to a 1Mhz data rate
	// LEDS.addLeds<WS2801, 11, 13, BGR, DATA_RATE_MHZ(1)>(leds, NUM_LEDS);

   	// LEDS.addLeds<LPD8806, 10, 11>(leds, NUM_LEDS);
   	// LEDS.addLeds<WS2811, 13, BRG>(leds, NUM_LEDS);
   	// LEDS.addLeds<LPD8806, BGR>(leds, NUM_LEDS);
}

void loop() { 
	for(int i = 0; i < 3; i++) {
		for(int iLed = 0; iLed < NUM_LEDS; iLed++) {
			memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));

			switch(i) { 
				// You can access the rgb values by field r, g, b
			 	case 0: leds[iLed].r = 128; break;

			 	// or by indexing into the led (r==0, g==1, b==2) 
			 	case 1: leds[iLed][i] = 128; break;

			 	// or by setting the rgb values for the pixel all at once
			 	case 2: leds[iLed] = CRGB(0, 0, 128); break;
			}

			// and now, show your led array! 
			LEDS.show();
			delay(10);
		}

		// fade up
		for(int x = 0; x < 128; x++) { 
			// The showColor method sets all the leds in the strip to the same color
			LEDS.showColor(CRGB(x, 0, 0));
			delay(10);
		}

		// fade down
		for(int x = 128; x >= 0; x--) { 
			LEDS.showColor(CRGB(x, 0, 0));
			delay(10);
		}

		// let's fade up by scaling the brightness
		for(int scale = 0; scale < 128; scale++) { 
			LEDS.showColor(CRGB(0, 128, 0), scale);
			delay(10);
		}

		// let's fade down by scaling the brightness
		for(int scale = 128; scale > 0; scale--) { 
			LEDS.showColor(CRGB(0, 128, 0), scale);
			delay(10);
		}
	}
}

Ist das überhaupt richtig also der code brauch ich den und wenn ja könnte mir den jemand umschreiben das er auf meinem arduino uno r3 lauft mit 50 LEDs ?

MFG Danke

hi,

Du mußt statt:
#define NUM_LEDS 150

schreiben:
#define NUM_LEDS 50

und bei
// LEDS.addLeds(leds, NUM_LEDS);
die beiden / rausnehmen und stattdessen vor:
LEDS.addLeds(leds, NUM_LEDS)->clearLeds(300);
reinstellen.

gruß stefan

nice danke,
jedoch spuckt er mir:

Fast2Dev.ino:10:26: error: FastSPI_LED2.h: No such file or directory
Fast2Dev:21: error: elements of array 'CRGB leds [50]' have incomplete type
Fast2Dev:21: error: storage size of 'leds' isn't known
Fast2Dev.ino: In function 'void setup()':
Fast2Dev:29: error: 'LEDS' was not declared in this scope
Fast2Dev:38: error: 'SM16716' was not declared in this scope
Fast2Dev.ino: In function 'void loop()':
Fast2Dev:53: error: invalid application of 'sizeof' to incomplete type 'CRGB' 
Fast2Dev:63: error: invalid use of incomplete type 'struct CRGB'
Fast2Dev:21: error: forward declaration of 'struct CRGB'
Fast2Dev:67: error: 'LEDS' was not declared in this scope
Fast2Dev:74: error: 'LEDS' was not declared in this scope
Fast2Dev:74: error: invalid use of incomplete type 'struct CRGB'
Fast2Dev:21: error: forward declaration of 'struct CRGB'
Fast2Dev:80: error: 'LEDS' was not declared in this scope
Fast2Dev:80: error: invalid use of incomplete type 'struct CRGB'
Fast2Dev:21: error: forward declaration of 'struct CRGB'
Fast2Dev:86: error: 'LEDS' was not declared in this scope
Fast2Dev:86: error: invalid use of incomplete type 'struct CRGB'
Fast2Dev:21: error: forward declaration of 'struct CRGB'
Fast2Dev:92: error: 'LEDS' was not declared in this scope
Fast2Dev:92: error: invalid use of incomplete type 'struct CRGB'
Fast2Dev:21: error: forward declaration of 'struct CRGB'

fehlermeldung aus.

Die Datei FastSPI_LED2.h hab ich unter Eigene Dokumente -> Arduino -> FastSPI_LED2

hi,

nein, die fastspi_LED2 muß ins arduino verzeichnis, also dort, wo die arduino.exe ist.
dort gibt es ein verzeichnis "libraries", dort gehört das verzeichnis fastspi_LED2 rein. dort drin muß dann direkt die datei fastspi_LED2.h sein und ein paar weitere, sowie das verzeichnis examples.

gruß stefan

ok nice keine fehlermeldungen bekommen
allerdings verhallten sich die LEDs bissel komisch einige leuchten nicht jedoch blinken sie ab und an mal auf!

sagen wir mal das ist normal, was ist der nächste schritt zum adalight?

aktueller code

// Uncomment this line if you have any interrupts that are changing pins - this causes the library to be a little bit more cautious
// #define FAST_SPI_INTERRUPTS_WRITE_PINS 1

// Uncomment this line to force always using software, instead of hardware, SPI (why?)
// #define FORCE_SOFTWARE_SPI 1

// Uncomment this line if you want to talk to DMX controllers
// #define FASTSPI_USE_DMX_SIMPLE 1

#include "FastSPI_LED2.h"


////////////////////////////////////////////////////////////////////////////////////////////////////
//
// test code
//
//////////////////////////////////////////////////

#define NUM_LEDS 50

struct CRGB leds[NUM_LEDS];

void setup() {
	// sanity check delay - allows reprogramming if accidently blowing power w/leds
   	delay(2000);

   	// For safety (to prevent too high of a power draw), the test case defaults to
   	// setting brightness to 25% brightness
   	LEDS.setBrightness(64);

   	// LEDS.addLeds<WS2811, 13>(leds, NUM_LEDS);
   	// LEDS.addLeds<TM1809, 13>(leds, NUM_LEDS);
   	// LEDS.addLeds<UCS1903, 13>(leds, NUM_LEDS);
   	// LEDS.addLeds<TM1803, 13>(leds, NUM_LEDS);

   	//LEDS.addLeds<SM16716>(leds, NUM_LEDS)->clearLeds(300);
	// LEDS.addLeds<WS2801>(leds, NUM_LEDS);
   	LEDS.addLeds<SM16716>(leds, NUM_LEDS);

   	// LEDS.addLeds<WS2811, 11>(leds, NUM_LEDS);

	// Put ws2801 strip on the hardware SPI pins with a BGR ordering of rgb and limited to a 1Mhz data rate
	// LEDS.addLeds<WS2801, 11, 13, BGR, DATA_RATE_MHZ(1)>(leds, NUM_LEDS);

   	// LEDS.addLeds<LPD8806, 10, 11>(leds, NUM_LEDS);
   	// LEDS.addLeds<WS2811, 13, BRG>(leds, NUM_LEDS);
   	// LEDS.addLeds<LPD8806, BGR>(leds, NUM_LEDS);
}

void loop() { 
	for(int i = 0; i < 3; i++) {
		for(int iLed = 0; iLed < NUM_LEDS; iLed++) {
			memset(leds, 0,  NUM_LEDS * sizeof(struct CRGB));

			switch(i) { 
				// You can access the rgb values by field r, g, b
			 	case 0: leds[iLed].r = 128; break;

			 	// or by indexing into the led (r==0, g==1, b==2) 
			 	case 1: leds[iLed][i] = 128; break;

			 	// or by setting the rgb values for the pixel all at once
			 	case 2: leds[iLed] = CRGB(0, 0, 128); break;
			}

			// and now, show your led array! 
			LEDS.show();
			delay(10);
		}

		// fade up
		for(int x = 0; x < 128; x++) { 
			// The showColor method sets all the leds in the strip to the same color
			LEDS.showColor(CRGB(x, 0, 0));
			delay(10);
		}

		// fade down
		for(int x = 128; x >= 0; x--) { 
			LEDS.showColor(CRGB(x, 0, 0));
			delay(10);
		}

		// let's fade up by scaling the brightness
		for(int scale = 0; scale < 128; scale++) { 
			LEDS.showColor(CRGB(0, 128, 0), scale);
			delay(10);
		}

		// let's fade down by scaling the brightness
		for(int scale = 128; scale > 0; scale--) { 
			LEDS.showColor(CRGB(0, 128, 0), scale);
			delay(10);
		}
	}
}

hi,

hast Du die masse der stromversorgung der led-kette mit masse von arduino verbunden? also minus von den leds mit gnd-pin vom arduino?
wenn nicht, erklärt das das seltsame verhalten.

sagen wir mal das ist normal, was ist der nächste schritt zum adalight?

öööööhhh, falls der richtige LED-strip gekommen wär, wie hättest Du vorgehabt, zu einem adalight zu kommen?

jo hab ich, hier dieser test code läuft auch

/*
 * An Arduino controller for LED strings based on the SM16716 controller.
 *
 * By Mike Tsao (github.com/sowbug). Copyright 2012, all rights reserved.
 *
 * You might see these being sold as WS2801 strands, and you're wondering why
 * your off-the-shelf WS2801 code isn't working. This sketch will restore
 * your confidence that your lights aren't broken.
 *
 * This code isn't the fastest, but it is just about the simplest you'll
 * find. For performance, investigate code that uses hardware SPI.
 *
 * Beware that everyone seems to use different wiring color schemes. I
 * found the order of the wires is more reliable. Looking at the IC side
 * of the board, you'll find from left to right: V+, Data, Clock, Ground.
 */

#define DATA_PIN (11)
#define CLOCK_PIN (13)

#define LIGHT_COUNT (49)

uint32_t pixels[LIGHT_COUNT];

#define pinModeFast(x, y) pinMode(x, y)
#define digitalWriteFast(x, y) digitalWrite(x, y)

void setup() {
  pinModeFast(DATA_PIN, OUTPUT);
  pinModeFast(CLOCK_PIN, OUTPUT);
  digitalWriteFast(DATA_PIN, LOW);
  digitalWriteFast(CLOCK_PIN, LOW);
}

static void set_pixel(uint8_t index, uint32_t color) {
  pixels[index] = color & 0x00FFFFFF;
}

static void set_pixel_rgb(uint8_t index, uint32_t r, uint32_t g, uint32_t b) {
  set_pixel(index, r | (g << 8) | (b << 16));
}

static void toggle_clock() {
  digitalWriteFast(CLOCK_PIN, HIGH);
  digitalWriteFast(CLOCK_PIN, LOW);
}

static void write_pixel(uint8_t i) {
  const uint32_t MASK = ((uint32_t)(1) << 24);
  uint32_t p = pixels[i] | MASK;
  int j = 25;
  while (j--) {
    digitalWriteFast(DATA_PIN, (p & MASK) ? HIGH : LOW);
    toggle_clock();
    p <<= 1;
  }
}

static void write_blank_pixel() {
  int j = 25;
  while (j--) {
    digitalWriteFast(DATA_PIN, 0);
    toggle_clock();
  }
}

static void show() {
  digitalWriteFast(DATA_PIN, LOW);
  for (int i = 0; i < 50; i++) {
    toggle_clock();
  }
  for (int i = 0; i < LIGHT_COUNT; ++i) {
    write_pixel(i);
  }
  write_blank_pixel();
  delay(1);
}

static void solid_color(uint32_t color) {
  for (int i = 0; i < LIGHT_COUNT; ++i) {
    set_pixel(i, color);
  }
}

static uint32_t simple_color(uint8_t color) {
  switch (color) {
  case 0:
    return 0x00ff0000;
  case 1:
    return 0x0000ff00;
  case 2:
    return 0x000000ff;
  case 3:
    return 0x00ffff00;
  case 4:
    return 0x00ff00ff;
  case 5:
    return 0x0000ffff;
  case 6:
    return 0x00ffffff;
  default:
    return 0x00330000;
  }
}

static uint32_t rand_color() {
  return simple_color(rand() % 7);
}

static uint32_t rand_color_except(uint32_t color) {
  uint32_t result_color;
  do {
    result_color = simple_color(rand() % 7);
  } while (result_color == color);
  return result_color;
}

static uint32_t get_dimmer_mask(uint32_t value) {
  return value | (value << 8) | (value << 16);
}

static void scroll(int8_t delta) {
  size_t bytes_to_move = (LIGHT_COUNT - delta) * sizeof(uint32_t);
  if (delta > 0) {
    memmove(&pixels[delta], &pixels[0], bytes_to_move);
  } else {
    memmove(&pixels[0], &pixels[-delta], bytes_to_move);
  }
}

static void wipe(uint8_t delay_msec) {
  for (int i = 0; i < LIGHT_COUNT; ++i) {
    scroll(1);
    set_pixel(0, 0);
    show();
    delay(delay_msec);
  }
}

void loop() {
  uint32_t color = 0;

  for (int i = 0; i < 7; ++i) {
    solid_color(simple_color(i));
    show();
    delay(1000);
  }

  // Halloween
  for (int i = 0; i < LIGHT_COUNT * 4; ++i) {
    uint8_t r = rand() % 10;
    color = 0;
    if (r < 7) {
    } else if (r < 8) {
      color = 0x00ff1f00;  // orange
    } else {
      color = 0x00002f00;  // green
    }
    scroll(1);
    set_pixel(0, color);
    show();
    delay(75);
  }
  wipe(75);

  for (int i = 0; i < LIGHT_COUNT * 10; ++i) {
    set_pixel(rand() % LIGHT_COUNT, rand_color());
    show();
    delay(50);
  }

  for (int i = 0; i < LIGHT_COUNT * 10; ++i) {
    scroll(1);
    set_pixel(0, rand_color());
    show();
    delay(100);
  }
  wipe(25);

  for (int i = 0; i < LIGHT_COUNT * 4; ++i) {
    color = rand_color_except(color);
    for (int j = 0; j < 5; ++j) {
      scroll(1);
      set_pixel(0, color);
      show();
      delay(25);
    }
  }

  for (int i = 0; i < LIGHT_COUNT * 4; ++i) {
    color = rand_color_except(color);
    for (int j = 0; j < 8; ++j) {
      scroll(-1);
      set_pixel(LIGHT_COUNT - 1, color);
      show();
      delay(5);
    }
  }

  for (int j = 0; j < 16; ++j) {
    color = rand_color_except(color);
    for (int i = 0; i < LIGHT_COUNT; ++i) {
      set_pixel(i, color);
      show();
      delay(5);
    }
  }

  for (uint8_t k = 0; k < 7; ++k) {
    uint32_t color = simple_color(k);
    for (uint32_t j = 0; j < 255; ++j) {
      solid_color(color & get_dimmer_mask(j));
      show();
    }
    for (uint32_t j = 255; j != 0; --j) {
      solid_color(color & get_dimmer_mask(j));
      show();
    }
  }
}

also er spricht alle LEDs in der kette an.

nunja laut anleitung sollte ich jetzt
........Öffnet anschließend wieder die arduino.exe und wählt oben über Datei->Sketchbook "LEDstream" aus und klickt danach auf "Upload", das ist in der Zeile der Kreis mit dem Pfeil nach rechts.

Wenn die Datei erfolgreich auf den Arduino hochgeladen wurde und ihr alles richtig angesteckt habt, sollten nun die LEDs alle zuerst Rot, dann Grün dann Blau für jeweils ca. 1 Sekunde aufleuchten was für euch das Zeichen ist, dass alles funktioniert.

Wenn bis hier alles funktioniert hat, installiert nun Prismatik (siehe Punkt 3).
In Prismatik wählt ihr anschließend unter Devices oben "Adalight" aus, dann den zuvor gemerkten COM-Port und die Anzahl eurer LEDs.

Danach erscheinen viele bunte nummerierte Kästchen um euren Bildschirm herum, welche der Anzahl eurer LEDs entspricht. Diese Kästchen könnt ihr nun einfach so verteilen wie ihr die LEDs an eurem Bildschirm angebracht habt. LED Nummer 1 ist die LED die direkt nach dem Arduino Board kommt. LED 50 demnach natürlich die letzte LED.

ist ardoino denn im normalfall jetzt eingestellt um befehle von anderen programmen zu empfangen?

hi,

gib mal einen link, woher Du diese anleitung hast.

gruß stefan

http://www.xbmcnerds.com/index.php?page=Thread&threadID=23347

hi,

könnte man sicher den code umbauen, aber das steht nicht dafür. kauf dir um 25€ lieber 60 WS2801er.

gruß stefan

da hast du recht, hab mir ja auch schon die anderen bestellt.
Dachte aber wenn jemand das mit den sm16716 schon gemacht hätte und zufällig in dem forum ist könnte man die ja nutzen,
so sind sie ja nix wert.
Ich dank dir aber viel mals für deine hilfe. werde noch bis Di versuchen das ans laufen zu bekommen.
Ab Di sollten dann die ws2801 da sein

viel glück, ich selbst arbeite nur mit dem WS28XX an anderen projekten. das adalight wär halt interessant, wenn mans auch mit dem fernseher zum laufen kriegen würde, nur vom pc ist es zu wenig, sonst hätt' ich längst schon eins...

gruß stefan

habs halt vor über ein ZOTAC ZBOX mit einem usb tv stick auch fürs normale TV Programm zu nutzen.
Aber erst soll es so mal funzen ^^

Habe hier LEDStream für sm16716 gefunden:

https://github.com/TA2k/Adalight/archive/master.zip

bei SM16716 ist zu beachten
pin 11 -> grün
pin 13 -> blau