Can't get file to compile on Due core mini.

hi There,

in need of you clever peoples help.
I dont now to much about programming, self learned hobbist. I have a program that compiles and runs perfectly on my Uno, however it is a bit sluggish and I decided to get icrease processing power by using a ARM processor "Due core mini".

It just won't compile, it first wanted the "software serial" libary---not sure why. As far as I understand it isn't neccesary, mabe something to do with the Nextion libary. after i've added software serial I get the following error when compiling.

Arduino: 1.8.1 (Windows 8.1), Board: "Arduino Due (Programming Port)"

C:\Program Files (x86)\Arduino\libraries\EEPROM\EEPROM.cpp:26:21: fatal error: c_types.h: No such file or directory

#include "c_types.h"

^

compilation terminated.

Multiple libraries were found for "Nextion.h"
Used: C:\Program Files (x86)\Arduino\libraries\ITEADLIB_Arduino_Nextion
Not used: C:\Users\willerpw\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master
Multiple libraries were found for "SPI.h"
Used: C:\Users\willerpw\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\libraries\SPI
Not used: C:\Program Files (x86)\Arduino\libraries\SPI
exit status 1
Error compiling for board Arduino Due (Programming Port).

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

please Help. I will add my programming separately.
Thanks in advance.

#include "Nextion.h"
#include <EEPROM.h>


#include "EmonLib.h"             // Include Emon Library
EnergyMonitor emon1;             // Create an instance

#define IGN 12 //Ignition Pin
#define SW 11 //Switch Pin 
#define CON 10 //Contactor OPEN/CLOSE
#define AC 7//mains sense pin
#define Gen_IP 6 // generator start sense pin

#define CLR(x,y) (x&=(~(1<<y)))
#define SET(x,y) (x|=(1<<y))


int IGN_Time=0;
unsigned long Report_Time=0;
unsigned long Stop_Time=0;
unsigned long Start_Time=0;
unsigned long Close_Time=0;

unsigned long startTime;  //for runtime measurements
unsigned long runTime;
unsigned long totalTime;
unsigned long totalTime1;
unsigned long resetEEPROM; 
int lastState;

int IGN_Attempt=0;

int period = 2000;        //time for updating Temp values and Analog values
unsigned long time_now = 0;

int period1 = 5000;        //time delay for contactor closing
unsigned long time_now1 = 0;

uint32_t autoselect=0; //declaring a integer to store auto select button state

uint8_t EEPROMaddress = 130;  //EEPROM adress resetable at refueling
uint8_t EEPROMaddress1 = 131; //EEPROM adress for total life meter

//--------------------Thermistor setup--------------------------//

int ThermistorPin = 0;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc, Tf;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
int temp;

//--------------------Gen Voltage & Current Setup--------------------------//

int analogpin3 = 3;//Gen voltage
int analogpin4 = 4;// Gen current
int genKva=0;  //Gen KVA
int genCurrent=0;
int genVoltage=0;

//-----------------Nextion Display setup Read-Write-------------//

NexButton b6= NexButton(0,43,"b6"); // Start Button Added
NexButton b0= NexButton(0,42,"b0"); // Stop Button Added
NexDSButton bt0= NexDSButton(0,20, "bt0"); //Auto Select, Dual State Button Added
NexButton b50= NexButton(4,10,"b50"); // Total runtime reset

char buffer[100] = {0};
NexTouch *nex_listen_list[] =
{
&b0,  //start button added
&b6,  //stop button added
&bt0, //Auto dual state button added
&b50,
NULL //string terminated
};  //end of touchlist

void b0PushCallback(void *ptr) //press event for button b2 -Manual stop
{ 

CLR(PORTB, 2);  //MAKE CONNECTOR LOW 
CLR(PORTB, 3);  //MAKE SW LOW
CLR(PORTB, 4);  //MAKE IGN LOW
}


void b6PushCallback(void *ptr) //press event for button b0 - Manual start
{
if(digitalRead((Gen_IP)==HIGH && (autoselect==0))|| ((Gen_IP)==HIGH && (autoselect==0)&& digitalRead(AC)==HIGH))//if generator is OFF and auto start off
    Serial.print("t13.txt="); //This is send to display
    Serial.print("\""); //Since we are sending Text and not numbers
    Serial.print("START IN PROGRESS");//Text I want to display
    Serial.print("\"");  //Since we are sending Text and not numbers
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff); 
    
 CLR(PORTB, 2);  //MAKE CONNECTOR LOW
 SET(PORTB, 3);  //MAKE SW HIGH
 SET(PORTB, 4);  //MAKE IGN HIGH

for(Start_Time=0;Start_Time<=5000;Start_Time++)//wait for 5SEC before truning of the gen
{
 if(digitalRead(Gen_IP)==LOW)
  { break; }
if(Start_Time>=5000)
CLR(PORTB, 3);  //MAKE SW LOW

delay(1);
}
}


void bt0PopCallback(void *ptr) //release event for dual state button bt0
{
  bt0.getValue(&autoselect);  //updating the integer "autoselect" with the autoselection button state      
}

void b50PushCallback(void *ptr) //press event for button b50, reset runtime
{ 

resetEEPROM=0;  
EEPROM.write(EEPROMaddress,resetEEPROM);
delay(50);

}

void setup() {
Serial.begin(115200);

b0.attachPush(b0PushCallback);  //Stop Button Press
b6.attachPush(b6PushCallback);  //Start Button Press
bt0.attachPop(bt0PopCallback, &bt0);  //Auto Button Release
b50.attachPush(b50PushCallback);  //Hour reset Button press

emon1.voltage(1, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift emonlib   //Utility Voltage
emon1.current(2, 111.1);       // Current: input pin, calibration.emonlib    //Utility Current

pinMode(IGN,OUTPUT);
pinMode(SW,OUTPUT);
pinMode(AC,INPUT);
pinMode(Gen_IP,INPUT);
 CLR(PORTB, 2);  //MAKE CONNECTOR LOW
 CLR(PORTB, 3);  //MAKE SW LOW
 CLR(PORTB, 4);  //MAKE IGN LOW


}
//-------------------Voltage and Current Readings------------------------//
void measurements(){

if(digitalRead(AC)==LOW){

emon1.calcVI(20,2000);         // Calculate all. No.of half wavelengths (crossings), time-out

float realPower       = emon1.realPower;        //extract Real Power into variable
float apparentPower   = emon1.apparentPower;    //extract Apparent Power into variable
float powerFActor     = emon1.powerFactor;      //extract Power Factor into Variable
float supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
float Irms            = emon1.Irms;             //extract Irms into Variable
int A = Irms;
int V = supplyVoltage;
int kva = apparentPower;

Serial.print("n3.val=");
Serial.print(A);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n4.val=");
Serial.print(V);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n5.val=");
Serial.print(kva);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

}

if (digitalRead(Gen_IP)==LOW){

genVoltage = analogRead(analogpin3);
genCurrent = analogRead(analogpin4);
genKva =genVoltage*genCurrent;

Serial.print("n0.val=");
Serial.print(genCurrent);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n1.val=");
Serial.print(genVoltage);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n2.val=");
Serial.print(genVoltage);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);


}

}

//---------------------Generator run Timer---------------------------------//
void runTimer(){

totalTime= EEPROM.read(EEPROMaddress);
totalTime1= EEPROM.read(EEPROMaddress1);

byte currentState = digitalRead(Gen_IP);
if(currentState == LOW && lastState == HIGH){
startTime = millis();

}
if(currentState == HIGH && lastState == LOW){
runTime = (millis() - startTime)/1000/60;  //runtime in minutes
totalTime=totalTime+runTime;  //to be saved to EEPROM
totalTime1=totalTime1+runTime; //to be saved to EEPROM, non resetable
EEPROM.write(EEPROMaddress,totalTime);
EEPROM.write(EEPROMaddress1,totalTime1);
}

lastState = currentState;


Serial.print("n7.val=");
Serial.print(runTime);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n8.val=");
Serial.print(totalTime);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n20.val="); //non resetable
Serial.print(totalTime1);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

Serial.print("n22.val=");
Serial.print(totalTime);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);


}


//----------------------------Temperature Probe Reading-------------------------//
void TempRead(){

Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
Tc = T - 273.15;
Tf = (Tc * 9.0)/ 5.0 + 32.0; 
temp=Tc;

Serial.print("n6.val=");
Serial.print(temp);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

}
//----------------------------DISPLAY UPDATE LOOP-----------------------------//
void displayUpdate(){


if(digitalRead(Gen_IP)==LOW)
{
     Serial.print("t13.txt="); //This is send to display
     Serial.print("\""); //Since we are sending Text and not numbers
     Serial.print("GENERATOR RUNNING");//Text I want to display
     Serial.print("\"");  //Since we are sending Text and not numbers
     Serial.write(0xff);
     Serial.write(0xff);
     Serial.write(0xff);

}
else
{     
    Serial.print("t13.txt="); //This is send to display
    Serial.print("\""); //Since we are sending Text and not numbers
    Serial.print("GENERATOR OFF");//Text I want to display
    Serial.print("\"");  //Since we are sending Text and not numbers
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
    digitalWrite(CON,LOW);
 
}

if(digitalRead(AC)==LOW)
{
     Serial.print("t17.txt="); //This is send to display
     Serial.print("\""); //Since we are sending Text and not numbers
     Serial.print("MAIN SUPPLY ON");//Text I want to display
     Serial.print("\"");  //Since we are sending Text and not numbers
     Serial.write(0xff);
     Serial.write(0xff);
     Serial.write(0xff);
}
else
{     
    Serial.print("t17.txt="); //This is send to display
    Serial.print("\""); //Since we are sending Text and not numbers
    Serial.print("MAIN SUPPLY FAIL");//Text I want to display
    Serial.print("\"");  //Since we are sending Text and not numbers
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
 
}



}
//---------------------------Gen Contactor Control Close---------------------------//
void concontrolclose(){

if(digitalRead(Gen_IP)==LOW &&(autoselect==1)) //if generator is running and auto selected
for(Close_Time=0;Close_Time<=5000;Close_Time++)//wait for 5SEC before closing the contactor
 {
  if(digitalRead(Gen_IP)==LOW &&(autoselect==0))  //if generator is running and auto off
   { break; }
if(Close_Time>=5000)
SET(PORTB, 2);  //MAKE CONNECTOR HIGH


delay(1);

 }
}
//----------------------------Main program loop-------------------------------//

void loop() {


if(millis() > time_now + period){
      time_now = millis();
      TempRead();
      measurements();
  }
    runTimer();
    displayUpdate();
    nexLoop(nex_listen_list); //Check for button presses
if((digitalRead(AC)==HIGH) && (autoselect==1))   //UTILITY AC FAILED AND AUTO SELECTED
{
 
 if(IGN_Attempt<3&&digitalRead(Gen_IP)==HIGH && (autoselect==1))//Gen off and auto selected
   {

   for(IGN_Time=0;IGN_Time<=2000;IGN_Time++)//give ign for 2 sec
    { 
      
            if(IGN_Attempt==0){                
              SET(PORTB, 3);  //MAKE SW HIGH
              SET(PORTB, 4);  //MAKE IGN HIGH
              Serial.print("t13.txt="); //This is send to display
              Serial.print("\""); //Since we are sending Text and not numbers
              Serial.print("STARTING ATTEMPT 1");//Text I want to display
              Serial.print("\"");  //Since we are sending Text and not numbers
              Serial.write(0xff);
              Serial.write(0xff);
              Serial.write(0xff);
              }
           if(IGN_Attempt==1){
              SET(PORTB, 3);  //MAKE SW HIGH
              SET(PORTB, 4);  //MAKE IGN HIGH            
              Serial.print("t13.txt="); //This is send to display
              Serial.print("\""); //Since we are sending Text and not numbers
              Serial.print("STARTING ATTEMPT 2");//Text I want to display
              Serial.print("\"");  //Since we are sending Text and not numbers
              Serial.write(0xff);
              Serial.write(0xff);
              Serial.write(0xff);
              }
           if(IGN_Attempt==2){
              SET(PORTB, 3);  //MAKE SW HIGH
              SET(PORTB, 4);  //MAKE IGN HIGH             
              Serial.print("t13.txt="); //This is send to display
              Serial.print("\""); //Since we are sending Text and not numbers
              Serial.print("FINAL ATTEMPT");//Text I want to display
              Serial.print("\"");  //Since we are sending Text and not numbers
              Serial.write(0xff);
              Serial.write(0xff);
              Serial.write(0xff);
              }
       
      if(digitalRead(Gen_IP)==LOW||digitalRead(AC)==LOW)//if gen has started or mains is available then break the ign loop
        break; 
      delay(1);  
    }
   if(IGN_Time>=2000&&digitalRead(Gen_IP)==HIGH&&digitalRead(AC)==HIGH) //if ign loop was complete and genrator has not started yet then wait for 3 sec before next attempt
   {
     for(int i=0;i<=3000;i++)
    {
              CLR(PORTB, 3);  //MAKE SW LOW
              CLR(PORTB, 4);  //MAKE IGN LOW
                  
      if(digitalRead(Gen_IP)==LOW||digitalRead(AC)==LOW)
      break; 
      delay(1);  
    }
   IGN_Attempt++;
   if ((IGN_Attempt > 2)&&(digitalRead(Gen_IP)==HIGH)) {
         CLR(PORTB, 3);  //MAKE SW LOW
         Serial.print("t13.txt="); //This is send to display
         Serial.print("\""); //Since we are sending Text and not numbers
         Serial.print("AUTO START FAIL");//Text I want to display
         Serial.print("\"");  //Since we are sending Text and not numbers
         Serial.write(0xff);
         Serial.write(0xff);
         Serial.write(0xff);
        
      }
   }     
   }
 else
   {
     if(digitalRead(Gen_IP)==LOW)//if generator has started reset the ignition counter
      {
        IGN_Attempt=0; 
        CLR(PORTB, 4);  //MAKE IGN LOW
        concontrolclose();                   
      }
             
   }
}   
else //if mains is available
{
CLR(PORTB, 4);  //MAKE IGN LOW
CLR(PORTB, 2);  //MAKE CON LOW
if(digitalRead(Gen_IP)==LOW &&(autoselect==1)) //if generator is running 
for(Stop_Time=0;Stop_Time<=120000;Stop_Time++)//wait for 5SEC before truning of the gen
  {
   if(digitalRead(Gen_IP)==HIGH||digitalRead(AC)==HIGH)  //Gen Off, Mains Off
    { break; }
if(Stop_Time>=120000)
//CLR(PORTB, 4);  //MAKE IGN LOW
//CLR(PORTB, 2);  //MAKE CON LOW
CLR(PORTB, 3);  //MAKE SW LOW

delay(1);
}

IGN_Attempt=0;

}
}

Any ideas?
According to my research, #include “c_types.h” is part of the Arduini IDE.
I have included it to my code, but still the same error.

Is there nobody on this forum anymore?

Maybe if you posted this in the correct section, people would have found it :wink: How is this an avrdude/stk500/bootloader issue?

I don't have a Due (and no experience with it) but to my knowledge it does not have aan EEPROM. I've installed the core and once I select the Due (programming port) as a target, EEPROM.h is no longer 'coloured' and the compiler complains that it can't find EEPROM.h.

So where does your EEPROM library come from?

PS
Using IDE 1.8.5.

I never know where to post :confused:
Did not know that. I will look into it. Like I said, used the cide on a mega and uno. Wasnt aware that the due dont have eeprom.
Thanks for taking the time in answering