Go Down

Topic: Error message on Arduino Due (Read 1 time) previous topic - next topic

isaac4664

I'm making a remote controller for an RC boat. I wrote some code for it, on an Arduino Mega 2560 it works perfect but when I try it on the Arduino Due I get an error. Any help?

Code:
Code: [Select]

#include <VirtualWire.h> //Virtual Wire Library
#include <LiquidCrystal.h> //LCD library

int TX_PIN = 11; //Transmitter pin

//Stern
int stern = A0; //Potentiometer pin (Stern plane)
int sternValue = 0; //Potentiometer Value (Stern plane)
const int sternNumReading = 10; //Working out the average (Stern plane)
int readingsStern[sternNumReading]; //Working out the average (Stern plane)
int readIndexStern = 0; //Working out the average (Stern plane)
int totalStern = 0; //Working out the average (Stern plane)
int averageStern = 0; //Working out the average (Stern plane)
int sternDegree;
int recStern; //To be send to reciever (Stern plane)

LiquidCrystal lcd(12, 8, 5, 4, 3, 2); //LCD display setup

typedef struct roverRemoteData //Transmitter setup
{
  int    TX_ID; //Transmitter ID
  int    sternData; //Data package
};

void setup()
{
  pinMode(stern, INPUT); // Setup Input
  Serial.begin(9600); //Serial setup
  lcd.begin(16, 2); //LCD display setup
  vw_set_tx_pin(TX_PIN); //TX Config
  vw_setup(2000); //VirtualWire setup

  for(int sternThisReading = 0; sternThisReading < sternNumReading; sternThisReading++) //Working out the average (Stern plane)
  {
    readingsStern[sternThisReading] = 0; //Working out the average (Stern plane)
  }
}

void loop()
{
  //Stern Average//
  totalStern = totalStern - readingsStern[readIndexStern];
  readingsStern[readIndexStern] = analogRead(stern);
  totalStern = totalStern + readingsStern[readIndexStern];
  readIndexStern = readIndexStern + 1;

  if(readIndexStern >= sternNumReading)
  {
    readIndexStern = 0;
  }
  averageStern = totalStern / sternNumReading;
  sternDegree = averageStern / 5.683;
  //Stern Average//

  //Stern Degree to Interval//
  if(sternDegree >= 0 && sternDegree <45)
    recStern = 45;
  if(sternDegree >= 45 && sternDegree <80)
    recStern = 68;
  if(sternDegree >= 80 && sternDegree <102)
    recStern = 90;
  if(sternDegree >= 102 && sternDegree <135)
    recStern = 113;
  if(sternDegree >= 135 && sternDegree <181)
    recStern = 135;   
  //Stern Degree to Interval//

   //LCD Display//
  lcd.clear();
  lcd.print("S");
  lcd.setCursor(1, 0);
  lcd.println(recStern);
  //LCD Display
 
  //Transmitter//
  struct roverRemoteData payload;
 
  payload.sternData = recStern;
 
  vw_send((uint8_t *)&payload, sizeof(payload));
  Serial.println("Sent");
  Serial.println(recStern);
  vw_wait_tx();
  //Transmitter//
}



Error:
Arduino: 1.6.7 (Windows 10), Board: "Arduino Due (Programming Port)"

C:\Users\isaac\Documents\Scripts\Arduino\EMETEUR\EMETEUR.ino:23:1: warning: 'typedef' was ignored in this declaration [enabled by default]

 };

 ^

C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:16:26: fatal error: util/crc16.h: No such file or directory

   #include <util/crc16.h>

                          ^

compilation terminated.

exit status 1
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.


Thanks for your time and help

jurs

on an Arduino Mega 2560 it works perfect but when I try it on the Arduino Due I get an error. Any help?
Has the VirtualWire Library ever been compatible with the DUE?

I don't think so.

Why do you want to use the obsolete VirtualWire library for 8-Bit Atmega controllers and don't use the current Radiohead Library, which also supports the DUE?

Go Up