I'm a complete beginner at Arduino, so perhaps i'm missing something obvious here.
However, I am trying to build a Tranciever and Reciever, using a VirtualWire HW and library.
I have gotten the tranciever to work, on an Arduino Uno.
However when I try to build the receiver, on an Arduino UNO R4 I get an error message:
In file included from C:\Users\jocke\Documents\Arduino\Car_Backup\Car_Backup.ino:1:0:
C:\Users\XXXXXX\Documents\Arduino\libraries\VirtualWire/VirtualWire.h:14:10: fatal error: wiring_private.h: No such file or directory
#include <wiring_private.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
They both call for the VirtualWire library in the exact same way. In fact, if i copy the entire same code from the Tranciever to the Reciever, I still get the error in the reciever.
What am i missing?
I found an earlier post that mentioned that wiring_private.h is an old code and doesn't work, so i replaced it as instructed. That's how i got past this error on the tranciever, so why is it showing up on the reciever again?
Thankful for anyone that can give me some pointers.
The full code on the tranciever is as following:
#include <VirtualWire.h>
const int Tx = 11;
const int xPin = A1;
const int yPin = A2;
const int swPin = 7;
void setup() {
// put your setup code here, to run once:
pinMode(swPin, INPUT);
digitalWrite(swPin, HIGH);
Serial.begin(9600);
//Transmitter
vw_set_tx_pin(Tx);
vw_setup(2000);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(analogRead(yPin));
// Serial.println(analogRead(xPin));
vw_send((uint8_t *)analogRead(yPin), strlen(analogRead(yPin)));
vw_send((uint8_t *)analogRead(xPin), strlen(analogRead(xPin)));
delay(100);
}
When I try and compile the code in post #1 with Uno R4 wifi (or R4 minima) I get this error, even when using the 1.27 version of the library.
C:\Users\Owner\Documents\Arduino\libraries\VirtualWire\VirtualWire.cpp:16:12: fatal error: util/crc16.h: No such file or directory
#include <util/crc16.h>
I think you are running into a fundamental compiler issue as util/crc16.h is part of the avr-libc standard libraries for the gcc compiler.
The Uno R4 has a renesas processor and is compiled with the arm-none-eabi-gcc\7-2017q4
compiler. It does not implement a crc16 routine.
I'm not certain what you will need to do to run virtual wire on the R4 and if indeed it can be done as there are timer issues as well as the crc issue,
Radio Head is does not list the R4 as one of the supported platforms in RadioHead.h
A range of platforms is supported:
///
/// - Arduino and the Arduino IDE (version 1.0 to 1.5.5 and later)
/// Including Diecimila, Uno, Mega, Leonardo, Yun etc. http://arduino.cc/, Also similar boards such as
/// - Moteino http://lowpowerlab.com/moteino/
/// - Anarduino Mini http://www.anarduino.com/mini/
/// - RedBearLab Blend V1.0 http://redbearlab.com/blend/ (with Arduino 1.0.5 and RedBearLab Blend Add-On version 20140701)
/// - etc.
///
/// - ChipKit Uno32 board and the MPIDE development environment
/// http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-UNO32
///
/// - Maple and Flymaple boards with libmaple and the Maple-IDE development environment
/// Maple | LeafLabs and Welcome to the OpenDrone Community! - OpenDrone
///
/// - Teensy including Teensy 3.1 and earlier built using Arduino IDE 1.0.5 with
/// teensyduino addon 1.18 and later.
/// Teensy USB Development Board
///
/// - ATtiny built using Arduino IDE 1.0.5 with the arduino-tiny support from Google Code Archive - Long-term storage for Google Code Project Hosting.
/// (Caution: these are very small processors and not all RadioHead features may work, depending on memory requirements)
///
/// Other platforms are partially supported, such as Generic AVR 8 bit processors, MSP430.
/// We welcome contributions that will expand the range of supported platforms.