7 Replies Latest reply on Aug 31, 2015 4:44 AM by Tamiroquai

    VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.

    andyFun

      Hey All,

      First off let me preface this by saying I am very new to all of this. I'm trying to include VirtualWire in a sketch I'm working with and I get a lot of compile errors. I was wondering if there was a special trick to including 3rd party libraries in sketches. My sketch works fine on a MEGA in Arduino IDE, but I get very curious library locatin errors when I try to test compile my sketch in Arduino-Intel IDE. See below.

       

      At first, it was having trouble finding the SPI.h path, so I duplicated the /VWutil/ folder and renamed it to the path it was checking in. (/util/) Then it threw these gems of errors.

       

      ** I understand VW isn't supported any more, but my sketch already uses VW. I can easily migrate it to RH, but I was just trying the path of least resistance.

       

      Board: Edison Breakout board + 315mhz RX, through a level shifter.

       

      Errors:

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp: In function 'uint8_t vw_timer_calc(uint16_t, uint16_t, uint16_t*)':

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:428:40: error: 'F_CPU' was not declared in this scope

              unsigned long inv_clock_time = F_CPU / ((unsigned long)prescalers[prescaler]);

                                              ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp: In function 'void vw_setup(uint16_t)':

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:521:5: error: 'TCCR1A' was not declared in this scope

          TCCR1A = 0; // Output Compare pins disconnected

          ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:522:5: error: 'TCCR1B' was not declared in this scope

          TCCR1B = _BV(WGM12); // Turn on CTC mode

          ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:522:18: error: 'WGM12' was not declared in this scope

          TCCR1B = _BV(WGM12); // Turn on CTC mode

                        ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:522:23: error: '_BV' was not declared in this scope

          TCCR1B = _BV(WGM12); // Turn on CTC mode

                            ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:529:5: error: 'OCR1A' was not declared in this scope

          OCR1A = nticks;

          ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:536:5: error: 'TIMSK' was not declared in this scope

          TIMSK |= _BV(OCIE1A);

          ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:536:18: error: 'OCIE1A' was not declared in this scope

          TIMSK |= _BV(OCIE1A);

                        ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp: At global scope:

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:790:4: error: expected constructor, destructor, or type conversion before '(' token

      ISR(VW_TIMER_VECTOR)

          ^

      C:\Users\andy\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:876:1: error: expected '}' at end of input

      } // extern "C"

      ^


      Any suggestions would be great.

      Thanks!

        • 1. Re: VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.
          Intel_Peter

          Hello andyFun,

           

          I think your problem might be caused due to the storage configuration of the Edison's library files. The correct place to put a library to use on Edison in the Intel-Arduino IDE is: arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries, unlike in the Aduino IDE where you store your libraries in arduino-1.0.5-r2\libraries.

          If you have any more doubts, don't hesitate to ask.

           

          Regards,

                      Peter

          • 2. Re: VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.
            andyFun

            Hey Peter,

            Thanks for the help. Unfortunately, now I'm getting this error:

             

            C:\CodeIDEs\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries\VirtualWire\VirtualWire.cpp:16:26: fatal error: util/crc16.h: No such file or directory

               #include <util/crc16.h>

                                      ^

            compilation terminated.

             

            Further exploration, I discovered that Arduino IDE 1.x+ comes with crc16.h native. Was this removed in the Intel version?

             

            I can copy the /VWutil/ folder and rename it to /util/, but then I just see the same exceptions and errors from the OP.

             

            Cheers,

            • 3. Re: VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.
              Intel_Peter

              Hello andyFun,

               

              I just did a quick research and I found out that indeed crc16.h is integrated within the Arduino IDE, however, as I understand it will not work on the Edison since Arduino and Edison have different architectures, so indeed it was removed from the Intel-Arduino IDE, I suggest you to try editing the library you want to use so it doesn't include crc16.h, maybe then you can make it work. I invite you to share your results in the community if you are able to make it work.

               

              Regards,

                          Peter

              • 5. Re: VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.
                andyFun

                Hey All,

                So after a day of hacking up the library, I arrived at a somewhat premature conclusion... I got the sketch to compile without errors, but I'm not convinced it's working properly (more accurately, I get no response from transmission). I still have some variables in my set up, that deviate from the known working version (ie with the Edison, I'm using a level shifter from 1.8V to 5V, but in other, more simple sketches, like simple LED blinks, it seem to work fine.)

                 

                Conclusion:

                Removing the CRC error checking from the library, guts the functionality of the receiver somewhat heavily. CRC is the main way they do error checking in data packets received with ASK protocols.

                I posted a thread on the forum for the library, and hopefully they have some useful info. No reply's yet.

                 

                What I'm trying to accomplish:

                I have a remote sensor. When the sensor is activated, it samples the load voltage from its battery, and then sends that value 10 times over 315Mhz packet radio. The receiver is supposed to listen for those packets, and then print them to the serial monitor. (Using CRC... sending the voltage 10 times. It seems triple redundant, but I likes to play it safe!)

                 

                *** I have 3 options right now.

                 

                1. Keep focusing on the library, and hope I can figure out why it's not reacting to transmissions. Try porting the hacked library to my UNO and see if I get similar behavior (or lack of).

                2. Create my own CRC algorithm and functionality (simplified, of course) which doesn't need any library or special functionality. (sounds difficult but I can mimic CRC with some lazy coding)

                3. Use an embedded tiny85 as the receiver micro controller, with full library support, and send that data to the Edison, in some form or an other (spi, Morse code, what ever!). This would also save me from needing a level shifter. I can use a PWM to clamp the output voltage to something the Edison can handle.

                 

                I'll keep you posted with what I try.

                Cheers,

                • 6. Re: VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.
                  Intel_Peter

                  Hello andyFun,

                   

                  We'll be glad to see your results, please do let us know when you are able to solve your problem. As always if you have any other doubts, don't hesitate to come back to the communities.

                   

                  Regards,

                              Peter

                  • 7. Re: VirtualWire/RadioHead - Libraries for Arduino IDE & Breakout Board - Boat load of compile errors.
                    Tamiroquai

                    Hi,

                     

                    Would like to know few things:

                    1. does this VirtualWire lib work with digital pins that are not the dedicated HW serial pins?

                    2. Was anyone ever able to compile it for Edison?