Skip to content

Commit

Permalink
Implement a now-tested "DUMB_BLINKER" feature.
Browse files Browse the repository at this point in the history
This is a feature for the kömblinkin's "RF_In_Strobe_Out" sketch that
will not use any RF data.  It will simply blink when the sketch is
active.  The idea being that instead of controlling the strobes by
setting an RF channel high, you would plug the Kömblinkin's power supply
into a controlled channel (either a 12V DC controlled channel, or a 120V
channel using a smaller 12V power supply) and enable/disable the strobes
by toggling that channel.

This is useful because the Kömblinkin hardware is a relatively cheap
dedicated strobe controller making it useful for people not actually
using other Komby RF gear.
  • Loading branch information
Materdaddy committed Aug 21, 2016
1 parent c32f0d0 commit e47ab6c
Showing 1 changed file with 76 additions and 85 deletions.
161 changes: 76 additions & 85 deletions examples/RF_In_Strobe_Out/RF_In_Strobe_Out.ino
Expand Up @@ -7,6 +7,9 @@
* Created on: Mar 2013
* Updated 7/8/2014
* Author: Greg Scull, komby@komby.com
* Updated 2016/08/21
* Author: Mat Mrosko, rfshowcontrol@matmrosko.com
* Comment: Add DUMB_BLINKER support
*
*/

Expand Down Expand Up @@ -37,6 +40,10 @@
/********************** END OF REQUIRED CONFIGURATION ************************/

/****************** START OF NON-OTA CONFIGURATION SECTION *******************/
// DUMB_BLINKER Derscription: http://learn.komby.com/wiki/58/configuration-settings#DUMB_BLINKER
// Valid Values: 0 or 1
#define DUMB_BLINKER 0

// LISTEN_CHANNEL Description: http://learn.komby.com/wiki/58/configuration-settings#LISTEN_CHANNEL
// Valid Values: 0-83, 101-127 (Note: use of channels 84-100 is not allowed in the US)
#define LISTEN_CHANNEL 7
Expand All @@ -56,11 +63,8 @@
/******************* END OF NON-OTA CONFIGURATION SECTION ********************/

/************** START OF ADVANCED SETTINGS SECTION (OPTIONAL) ****************/



// DEBUG Description: http://learn.komby.com/wiki/58/configuration-settings#DEBUG
#define DEBUG 1
#define DEBUG 0

// STROBE_MODE Description: http://learn.komby.com/wiki/58/configuration-settings#STROBE_MODE
//ValidValues: 1 or 0 (on or off)
Expand Down Expand Up @@ -101,92 +105,85 @@ unsigned char pwmFrequency = 75;
int numRegisters = 2;
int numLeds;



bool readytoupdate=false;
byte *buffer;

byte * buffer;


//Uncomment for serial
#define DEBUG 1

void strobeMode(int d);

//Arduino setup function.
void setup() {
void setup()
{
Serial.begin(115200);
buffer[0]=255;

#if DEBUG
Serial.println("Starting kömblinkin...");
#endif

// Sets the number of 8-bit registers that are used.
ShiftPWM.SetAmountOfRegisters(numRegisters);
ShiftPWM.SetPinGrouping(1);



radio.EnableOverTheAirConfiguration(OVER_THE_AIR_CONFIG_ENABLE);

printf_begin();

#if !DUMB_BLINKER
radio.EnableOverTheAirConfiguration(OVER_THE_AIR_CONFIG_ENABLE);
if(!OVER_THE_AIR_CONFIG_ENABLE)
{
int logicalControllerSequenceNum = 0;
radio.AddLogicalController(logicalControllerSequenceNum, HARDCODED_START_CHANNEL, HARDCODED_NUM_CHANNELS,0);
radio.AddLogicalController(logicalControllerSequenceNum, HARDCODED_START_CHANNEL, HARDCODED_NUM_CHANNELS, 0);
}
printf_begin();

radio.Initialize( radio.RECEIVER, pipes, LISTEN_CHANNEL,DATA_RATE ,RECEIVER_UNIQUE_ID);
delay (100);

numLeds = radio.GetNumberOfChannels(0);
delay (100);
radio.Initialize(radio.RECEIVER, pipes, LISTEN_CHANNEL,DATA_RATE, RECEIVER_UNIQUE_ID);
delay(100);

numLeds = radio.GetNumberOfChannels(0);
delay(100);

radio.printDetails();
//initialize data buffer
buffer= radio.GetControllerDataBase(0);


ShiftPWM.Start(pwmFrequency,maxBrightness);


ShiftPWM.SetAll(0);
buffer=radio.GetControllerDataBase(0);
#endif


ShiftPWM.Start(pwmFrequency, maxBrightness);
ShiftPWM.SetAll(0);
delay(100);

#ifdef DEBUG
for (int i =0; i < 16;i++)
{

ShiftPWM.SetOne(i, 255);
delay(800);
ShiftPWM.SetOne(i, 0);
}
delay(1000);
#if DEBUG
for (int i=0; i<16; i++)
{
printf(".");
ShiftPWM.SetOne(i, 255);
delay(800);
ShiftPWM.SetOne(i, 0);
}
printf("\n");
delay(1000);
#endif


#if !DUMB_BLINKER
cli();
delay(100);
#endif
}

// Do work loop
void loop(void){

if (radio.Listen()){

void loop(void)
{
#if !DUMB_BLINKER
if (radio.Listen())
{
sei();
strobeMode( buffer[0]);

strobeMode(buffer[0]);
cli();

}

#else
printf("Blink\r\n");
strobeMode(1);
#endif
}


//Not working at the moment
void updateLEDsWithRFData(void){
void updateLEDsWithRFData(void)
{
ShiftPWM.SetAll(0);
for (int i =0; i < numLeds;i++)
{
Expand All @@ -196,37 +193,31 @@ void updateLEDsWithRFData(void){
delay(30);
}



//handle the strobing randomly
void strobeMode( int d ) {
void strobeMode(int d)
{
ShiftPWM.SetAll(0);
if (d>0){


ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);

ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);




if (d>0)
{
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);
ShiftPWM.SetOne(random8()%16, 255);

//delay so you can see the strobe
delay(STROBE_DURATION);
}

}
}

0 comments on commit e47ab6c

Please sign in to comment.