Arduino code won't compile seeking help

This is the compile error.

C:\Users\lyons\AppData\Local\Temp\cctBgVtH.ltrans0.ltrans.o: In function setup': c:\Users\lyons\OneDrive\Documents\Arduino\sketch_jul31a final/sketch_jul31a final.ino:56: undefined reference to Renard::begin(unsigned char*, unsigned char, HardwareSerial*, unsigned long)'
C:\Users\lyons\AppData\Local\Temp\cctBgVtH.ltrans0.ltrans.o: In function loop': c:\Users\lyons\OneDrive\Documents\Arduino\sketch_jul31a final/sketch_jul31a final.ino:90: undefined reference to Renard::receive()'
collect2.exe: error: ld returned 1 exit status
Compilation error: Error: 2 UNKNOWN: exit status 1

This is the code.

/ VERSION WITH RENARD PROTOCOL USING SERIAL (PINS 14 TO FTDI RX AND 15 TO FTDI TX)

// This code was written by Victor Perez for doityourselfchristmas.com based on the code from Zparticle, Si_champion and Neil Tapp.
 // To adapt the code to your case, just change this top section, with the #define lines.
 
 // Includes the watchdog timer library
 #include <avr/wdt.h>
 // KG add for renard. Include the Arduino Renard library by Bill Porter
 #include <Arduino-Renard.h>

 // This sets how many channels will vixen be sending. Can be set to any number from 1 to 48 for Arduino Mega, and 1 to 18 for Arduino Uno.
 #define CHANNEL_COUNT 8

 Renard renard;  //KG add for renard

 byte incomingByte[CHANNEL_COUNT];  //KG add for renard
 
 // speed for the com port for talking with vixen. From 9600 to 115200. Use the same speed as set in Vixen.
 #define VIXEN_COM_SPEED 57600
 
 // Timeout waiting for serial input before going to random mode (in milliseconds).
 #define TIME_OUT 1000
 
 // If the relays turn On and Off opposite to Vixen sequence, change "#define MODE NOT_INVERTED" for "#define MODE INVERTED"
 #define NOT_INVERTED 0
 #define INVERTED 1
 #define MODE NOT_INVERTED

 // which pins control which channels
 // You can change these assignment to use different pins, but be very careful to not repeat the same pin number for 2 channels. 
 // DO NOT use pings 0 and 1, as those are for the serial port to talk to the computer.
 #define CH01 5
 #define CH02 6
 #define CH03 7
 #define CH04 8
 #define CH05 9
 #define CH06 10
 #define CH07 11
 #define CH08 12
 int channels[] = {CH01,CH02,CH03,CH04,CH05 ,CH06,CH07,CH08};

 // KG subtract for renard - int incomingByte[CHANNEL_COUNT];

int i = 0;     // Loop counter
volatile unsigned long  timer_a = 0; // new line

//setup the pins/ inputs & outputs
void setup(){

 renard.begin((uint8_t*)&incomingByte, CHANNEL_COUNT, &Serial, 57600); //KG add for renard

  // enable the watchdog timer with a time of 1 second. If the board freezes, it will reset itself after 1 second.
  wdt_enable(WDTO_1S);
  
  // specifically for the UNO
  //sei();  

// initalize PWM Channels / Pins
 for (i=0; i < CHANNEL_COUNT; i++){
    pinMode(channels[i], OUTPUT);
  }

// set all the realys to off to start with
if (MODE == NOT_INVERTED) {
 for (i=0; i < CHANNEL_COUNT; i++){
     digitalWrite(channels[i], LOW);
 }
}

else {
 for (i=0; i < CHANNEL_COUNT; i++){
     digitalWrite(channels[i], HIGH);
 }
}

 testSequence();
 
// set up Serial according to the speed defined above.
  Serial.begin(VIXEN_COM_SPEED);
}

void loop(){
  
   if (renard.receive()) {   //KG modified from VictorPV original
     wdt_reset(); // resets the watchdog
     timer_a = millis (); // new line
     int uno = Serial.read();
  
     if (MODE == NOT_INVERTED) {
      for (i=0; i < CHANNEL_COUNT; i++){
      int value = incomingByte[i];
      if (value > 5) {
        analogWrite(channels[i], value);
      }
      else {
        digitalWrite(channels[i], LOW);
      }
      }
     }
     else {
     for (i=0; i < CHANNEL_COUNT; i++){
      int value = incomingByte[i];
      if (value < 25) {
        analogWrite(channels[i], (255-value));
      }
      else {
        digitalWrite(channels[i], HIGH);
      }
      }
     }
     
   }
// Random mode code. Random mode starts if no serial input has been received in TIME_OUT millisenconds
   else {
     wdt_reset(); // resets the watchdog
     unsigned long diff = millis() - timer_a;
     if (diff >= TIME_OUT) {
       timer_a = millis ();
       int random_a = 0;
       for (i=0; i < CHANNEL_COUNT; i++){
         random_a = random(0, 2);
         if (random_a == 0) {
           digitalWrite(channels[i], LOW);
         }
         else {
           digitalWrite(channels[i], HIGH);
         }
       }
     }
   }
}

void testSequence(){

if (MODE == NOT_INVERTED) {
 for (i=0; i < CHANNEL_COUNT; i++){
   wdt_reset(); // resets the watchdog
   digitalWrite(channels[i], HIGH);
   delay (500);
   digitalWrite(channels[i], LOW);
 }
}

else {
 for (i=0; i < CHANNEL_COUNT; i++){
   wdt_reset(); // resets the watchdog
   digitalWrite(channels[i], LOW);
   //kg delay (500);
  //kg digitalWrite(channels[i], HIGH);
   }
 }
}

Please edit your post to add code tags, as described in How to use the forum.

This looks odd:

#define Renard
#define renard

Try deleting them.

@lyonschris, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project; see About the Installation & Troubleshooting category.

Please spend some time reading
How to get the best out of this forum which among other things describes the use of code tags; makes it easier to read, prevents the forum software mangling the code and makes it easy to copy for those that want to look at it in an editor.

You are telling the compiler to find all occurrences of the words Renard and renard , then replace them with nothing (basically remove them), so that renard.begin becomes .begin, which the compiler sees as an error.

david_2018
I removed the #define Renard and #renard and this is the compiler error.

C:\Users\lyons\AppData\Local\Temp\cctBgVtH.ltrans0.ltrans.o: In function setup': c:\Users\lyons\OneDrive\Documents\Arduino\sketch_jul31a final/sketch_jul31a final.ino:56: undefined reference to Renard::begin(unsigned char*, unsigned char, HardwareSerial*, unsigned long)'
C:\Users\lyons\AppData\Local\Temp\cctBgVtH.ltrans0.ltrans.o: In function loop': c:\Users\lyons\OneDrive\Documents\Arduino\sketch_jul31a final/sketch_jul31a final.ino:90: undefined reference to Renard::receive()'
collect2.exe: error: ld returned 1 exit status
Compilation error: Error: 2 UNKNOWN: exit status 1

FWIW, I copied the code in the original post and corrected the first line (missing '/' in the comment...) I then went to GitHub - madsci1016/Arduino-Renard: A Renard communications library for Arduino and downloaded the library there.

When I compile the code I get some warnings:

In file included from C:\Users\ ... \Arduino\sketch_jul31a\sketch_jul31a.ino:10:0:
C:\Users\troz\Documents\Arduino\libraries\Arduino-Renard-master/Arduino-Renard.h:25:16: warning: extra tokens at end of #ifndef directive
 #ifndef Arduino-Renard_h
                ^
C:\Users\ ... \Arduino\libraries\Arduino-Renard-master/Arduino-Renard.h:26:16: warning: ISO C++11 requires whitespace after the macro name
 #define Arduino-Renard_h
                ^
In file included from C:\Users\ ... \Arduino\libraries\Arduino-Renard-master\Arduino-Renard.cpp:1:0:
C:\Users\ ... \Arduino\libraries\Arduino-Renard-master\Arduino-Renard.h:25:16: warning: extra tokens at end of #ifndef directive
 #ifndef Arduino-Renard_h
                ^
C:\Users\ ... \Arduino\libraries\Arduino-Renard-master\Arduino-Renard.h:26:16: warning: ISO C++11 requires whitespace after the macro name
 #define Arduino-Renard_h

but it otherwise compiled on a Mega2560:

Sketch uses 4582 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 225 bytes (2%) of dynamic memory, leaving 7967 bytes for local variables. Maximum is 8192 bytes.

That often means that the directory that contains Arduino-Renard.h doesn't also include Arduino-Renard.cpp which defines the library functions.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.