Error when verifying code. Dmx controlled LED strips.

Hello everyone.

This is my first post here. I'm hoping you might be able to help me since I'm kind of stuck. I have a project where I aim to be able to control a single LED strip with video via. a program called madmapper. By googling i stumbled upon this article: http://vjspain.com/blog/2014/02/10/arduino-based-digital-led-strip-dimmer/ and decided that i wanted to try and stick as close as possible to his setup. Only difference is he's using 4x1 meter of WS2812's and I'm trying to get a single 5 meter lpd8806 going.

I installed the appropriate libraries: Dmx shield library: http://sourceforge.net/projects/dmxlibraryforar/ FAST_SPI LED2 library: https://code.google.com/p/fastspi/

Then i tried to verify the authors code, but got the following error message:

 ArtNET_DMX_Kike.ino: In function 'void setup()':
ArtNET_DMX_Kike:43: error: 'OnFrameReceiveComplete' was not declared in this scope

The same thing happened when i tried to verify one of the example sketches that the conceptinetics library came with, particularly DMX_Slave_signal_Timeout as it contains the same piece of code that I'm having trouble with, and sure enough, the same error message appears.

I then contacted the author and asked for help. He suggested that the library might have been installed in some erroneous way. Ok. Then i reinstalled the library and tried again and now the example sketch i mentioned works fine.. It compiles. But the error message above is still there when i try to verify the code that i want to use. How can that be?

I should mention that i have an edited version the code (in the link) tailored to my specific needs. But both the one in the link and my own code produces the same error.

I basically have no clue why I get this error. It works fine for the author, but not for me, even if it's the exact (assumption) same code.

PS: This is my first project with arduino ever, and also with coding. I'm a VJ and what I do best is 3d mapping. My motivation for getting in to this is that would love to integrate LEDs into my mapping projects so that the content/source of animation is the same, but expressed though different medias.. In the long run I'd like to make my projects interactive and I have this idea that arduinos is the way to go. :)

We're really not interested in helping you solve problems with someone else's code. We are more than happy to help you solve problems with YOUR code. After all, if it compiles, you don't plan to upload the code to someone else's Arduino, do you?

Post YOUR code.

Of course.

Just thought that since it’s the same error, I might as well refer to the original code.
Here is the code i wish to compile and upload to my arduino (uno):

#include "FastSPI_LED2.h"
#include <Conceptinetics.h>

// Number of slave DMX channels
 #define DMX_SLAVE_CHANNELS 120
// Define the channel of the device
 #define DMX_CHNLS 0
// Configure a DMX slave controller
 DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );
// Number of independents LEDs in each strip segment
 #define NUM_LEDS 160
// Output PIN (Data LED strip connection) definition
 #define DATA_PIN1 9

// This is an array of leds. One item for each led in your strip. All strips must have the same number of led segments, defined by NUM_LEDS.
 CRGB leds1[NUM_LEDS];
const int ledPin = 13;
 void setup() {

  // Initialize each segment
  FastLED.addLeds<LPD8806, DATA_PIN1, RGB>(leds1, NUM_LEDS);
  // Enable DMX slave interface and start recording
  // DMX data

  dmx_slave.enable (); 
 // Set start address to 1, this is also the default setting
  // You can change this address at any time during the program
  dmx_slave.setStartAddress (1);
  
  // Register on frame complete event to determine signal timeout
  //
  dmx_slave.onReceiveComplete ( OnFrameReceiveComplete );
 }
void loop() {
 // Update the value of LED state 
 for (int i = 0; i < NUM_LEDS; i++) {
 // LED group in i position of first bar 
  leds1[i].r = dmx_slave.getChannelValue(3*i+1+DMX_CHNLS);
  leds1[i].g = dmx_slave.getChannelValue(3*i+2+DMX_CHNLS);
  leds1[i].b = dmx_slave.getChannelValue(3*i+3+DMX_CHNLS);
 }
 // Once updated, refresh LEDs and hold on for 30 ms.
  FastLED.show();
  delay(30);

}
  dmx_slave.onReceiveComplete ( OnFrameReceiveComplete );

This is telling the dmx_slave instance that it should call the function OnFrameReceiveComplete() when the onReceiveComplete event occurs. This function is not defined anywhere in your (borrowed/stolen/filched/used with permission) code.

Looks like that page is going to be useless. Perhaps the author could help.

Hi oculastik

You said that you have managed to get a sample program working now that gave the same error before. Can you post that program?

Thanks

Ray

Hi Hackscribble. The example sketch I mentioned:

/*
  DMX_Slave.ino - Example code for using the Conceptinetics DMX library
  Copyright (c) 2013 W.A. van der Meeren <danny@illogic.nl>.  All right reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/


#include <Conceptinetics.h>

//
// CTC-DRA-13-1 ISOLATED DMX-RDM SHIELD JUMPER INSTRUCTIONS
//
// If you are using the above mentioned shield you should 
// place the RXEN jumper towards G (Ground), This will turn
// the shield into read mode without using up an IO pin
//
// The !EN Jumper should be either placed in the G (GROUND) 
// position to enable the shield circuitry 
//   OR
// if one of the pins is selected the selected pin should be
// set to OUTPUT mode and set to LOGIC LOW in order for the 
// shield to work
//

//
// The slave device will use a block of 10 channels counting from
// its start address.
//
// If the start address is for example 56, then the channels kept
// by the dmx_slave object is channel 56-66
//
#define DMX_SLAVE_CHANNELS   10 

//
// Pin number to change read or write mode on the shield
// Uncomment the following line if you choose to control 
// read and write via a pin
//
// On the CTC-DRA-13-1 shield this will always be pin 2,
// if you are using other shields you should look it up 
// yourself
//
///// #define RXEN_PIN                2


// Configure a DMX slave controller
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

// If you are using an IO pin to control the shields RXEN
// the use the following line instead
///// DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS , RXEN_PIN );

const int ledPin = 13;

unsigned long       lastFrameReceivedTime;
const unsigned long dmxTimeoutMillis = 10000UL;


// the setup routine runs once when you press reset:
void setup() {             
  
  // Enable DMX slave interface and start recording
  // DMX data
  dmx_slave.enable ();  
  
  // Set start address to 1, this is also the default setting
  // You can change this address at any time during the program
  dmx_slave.setStartAddress (1);
  
  //
  // Register on frame complete event to determine signal timeout
  //
  dmx_slave.onReceiveComplete ( OnFrameReceiveComplete );
  
  // Set led pin as output pin
  pinMode ( ledPin, OUTPUT );
}

// the loop routine runs over and over again forever:
void loop() 
{
   // Get current time
   unsigned long now = millis();
 
   // If we didn't receive a DMX frame within the timeout period 
   // clear all dmx channels
   if ( now - lastFrameReceivedTime > dmxTimeoutMillis )
       dmx_slave.getBuffer().clear();
 
  //
  // EXAMPLE DESCRIPTION
  //
  // If the first channel comes above 50% the led will switch on
  // and below 50% the led will be turned off
  
  // NOTE:
  // getChannelValue is relative to the configured startaddress
  if ( dmx_slave.getChannelValue (1) > 127 )
    digitalWrite ( ledPin, HIGH );
  else
    digitalWrite ( ledPin, LOW );
    
}

void OnFrameReceiveComplete (unsigned short channelsReceived)
{
  if ( channelsReceived == DMX_SLAVE_CHANNELS)
  {
    // All slave channels have been received
  }
  else
  {
    // We have received a frame but not all channels we where 
    // waiting for, master might have transmitted less
    // channels
  }

  // Update receive time to determine signal timeout
  lastFrameReceivedTime = millis ();
}

Hi there

As PaulS said, the function OnFrameReceiveComplete() is not defined in your program. In the sample program, it is (see below).

I don't know if this is a generic function which you can just paste into your program, or if you need to write a specific version to meet your requirements.

void OnFrameReceiveComplete (unsigned short channelsReceived)
{
  if ( channelsReceived == DMX_SLAVE_CHANNELS)
  {
    // All slave channels have been received
  }
  else
  {
    // We have received a frame but not all channels we where 
    // waiting for, master might have transmitted less
    // channels
  }

  // Update receive time to determine signal timeout
  lastFrameReceivedTime = millis ();
}