am using photon and the strip LED WS2801 that has 4 connections
+
CI (clock) connect to A5
DI (Data) connect to A3
-
how can I use the ZeRBGa to interface with this
should I use the option split ? or switch it to Merge?
how I can control the CI to change the colors
thanks
this is sample of code
#include "blynk/blynk.h"
#include "application.h";
char auth[] = "xxxx";
void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud.
SPI.begin();
//SPI.setBitOrder(MSBFIRST);
// SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV128);
}
void loop()
{
Blynk.run(); // All the Blynk Magic happens here...
SPI.transfer(0xFF); // controlling 18 leds
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0xFF);
SPI.transfer(0x00);
SPI.transfer(0x00);
//SPI.transfer(0x00);
}
I strongly recommend you use the http://fastled.io/ library for a project like this. I’ve had great results with that and blynk. I set my zergba to merged and assign it to Vitrual Pin 3 in the example below.
My sketch is something like this:
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
#include <BlynkSimpleSerialBLE.h>
#include <SPI.h>
#include <FastLED.h>
char auth[] = "...";
#define NUM_LEDS 20
#define LED_PIN 18
#define COLOR_ORDER GRB
#define CHIPSET WS2811
CRGB g_leds[NUM_LEDS];
CHSV g_zergba = {33, 255, 255};
void setup() {
Serial.begin(115200);
Blynk.begin(auth);
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(g_leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness(100); //optional
fill_solid( g_leds, NUM_LEDS, CRGB::Black );
FastLED.show();
}
BLYNK_WRITE(V3) //Zergba
{
CRGB c = CRGB(param[0].asInt(), param[1].asInt(), param[2].asInt());
g_zergba = rgb2hsv_approximate(c);
g_zergba = CHSV(g_zergba.h, g_zergba.s, 255);
}
void loop() {
Blynk.run();
fill_solid( g_leds, NUM_LEDS, g_zergba );
FastLED.show();
}
helo thanks for ur replay .
am using photon how can I modify this to make it work with photon
thanks
sir
It should more-or-less work, you’ll need to add something like the following at the top:
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h> // This part is for Ethernet stuff
You probably want to take a sketch that does work for your board and copy the bits you need from that.
Alas I don’t have any wifi arduinos (yet), so this is all based on my internet research. You may have to fix some minor issues yourself - good luck!