I2C sending float from slave to master with I2C_Anything

Hello,

I’m currently trying to send data (two floats and one integer analog reading between 0-1023) from a slave Arduino to a master Arduino, using I2C and the I2C_Anything.h library.

Unfortunately, I can’t get it to work. The values just aren’t transmitted, and when I try to print them out via LCD display on the master, it just shows “nan” or “-1”.

Here’s the I2C-relevant master code I’ve got so far:

#include <Wire.h>

#include <I2C_Anything.h>

// [...]

const byte SLAVE_ADDRESS = 2;

float myfloat1;
float myfloat2;
int myinteger;

// [...]


void setup{

 Wire.begin(); // join I2C bus as master

// [...]


// activate internal pullups 

  digitalWrite(SDA, 1);
  digitalWrite(SCL, 1);

// [...]


}

// [...]


void loop{

  Wire.requestFrom(SLAVE_ADDRESS);
    I2C_readAnything(myfloat1);
    I2C_readAnything(myfloat2);
    I2C_readAnything(myinteger);
    Wire.endTransmission ();

}

And here’s the slave code, to send data from the slave to the master:

#include <I2C_Anything.h>
#include <Wire.h>

// [...]

const byte MY_ADDRESS = 2;


float myfloat1;
float myfloat2;
int myinteger;

// [...]

void setup(){

// activate internal pullups


  digitalWrite(SDA, 1);
  digitalWrite(SCL, 1);

// [...]


void setup() {
  
  Wire.begin(MY_ADDRESS);                // join i2c bus with address #2
  Wire.onRequest(requestEvent);         // register event

// [...]

}

// [...]


void loop{


// [...]

void requestEvent(){

	    I2C_writeAnything (myfloat1);  
	    I2C_writeAnything (myfloat2);
            I2C_writeAnything (myinteger);

}



}

Any help is appreciated.

  • carguy

Which Arduino boards do you use ? From where did you get the I2C_Anything ? Did you connect the grounds ? Do you use Arduino IDE 1.6.10 ? Do you know that the Arduino IDE can be started twice to work on two Arduino boards at the same time ?

The Wire.requestFrom() should request the amount of bytes, and it should not be followed by a Wire.endTransmission(). https://www.arduino.cc/en/Reference/WireRequestFrom

Can you make two small test sketches with an integer, to make that work ? If possible, two working test sketches, so we might try them.

Koepel: From where did you get the I2C_Anything ?

That's Nick Gammon's library. It's described about 3/4 of the way down this page I2C under the title "Send and receive any data type".

The header can be downloaded from I2C_Anything.zip

I had the exact same problem as you, have a look here this should help you cure your problem. In the topic chuck kindly provided a wire library which includes I2C write anything and just don't include it my sample code is there which I've got working with the latest version http://forum.arduino.cc/index.php?topic=104732.msg2860312#msg2860312

Please don't use a custom Wire library that is not compatible. You get into so much more trouble. Even with newest Arduino IDE 1.6.10 some improvements have been made to the official Wire library. Read this : http://forum.arduino.cc/index.php?topic=396091.msg2725538#msg2725538

I’m running Arduino 1.7.4, so it’s a fairly new version of the IDE.

I have now abandoned trying to use I2C_Anything for the time being, and have tried my luck with sending the floats as bytes and then making unions at the other end. But this hasn’t worked either.

Here’s my sample code:

Master:

#include <Wire.h>


float fuelConsumption;
float fuelGauge;



byte data[8];

void setup() {


  Wire.begin(1);


  // activate internal pullups for twi. 4.7K resistors are also used on the master inputs.

  digitalWrite(SDA, 1);
  digitalWrite(SCL, 1);

}

void loop() {


  delay(2900);


  //Getting Info from Fuel System

  Wire.beginTransmission(2);
  Wire.requestFrom(2, 8);              // request 8 bytes from slave device #2
  if (Wire.requestFrom(2, 8) == 8)
  {
    int i = 0;
    while (Wire.available())   // slave may send less than requested
    {
      data[i] = Wire.read(); // receive a byte as character
      i = i + 1;

      Serial.println(data[i]);
    }

   
    union cons {byte cons_b[4]; float cons_fval;} cons_union;

    cons_union.cons_b[0] = data[0];
    cons_union.cons_b[1] = data[1];
    cons_union.cons_b[2] = data[2];
    cons_union.cons_b[3] = data[3];

    fuelConsumption = cons_union.cons_fval;

    union fuel {byte fuel_b[4]; float fuel_fval;} fuel_Union;      

    fuel_Union.fuel_b[0] = data[8];
    fuel_Union.fuel_b[1] = data[9];
    fuel_Union.fuel_b[2] = data[10];
    fuel_Union.fuel_b[3] = data[11];

    fuelGauge = fuel_Union.fuel_fval;

    Wire.endTransmission();

  }

// Variables are printed out on an LCD display; code omitted.

}

Slave:

#include <Wire.h>


// Sketch for a car fuel consumption meter


#define injector 2
#define fuelgauge A1

const byte MY_ADDRESS = 2;


volatile byte* INPUT1FloatPtr;
volatile byte* INPUT2FloatPtr;



void setup() {
  
  Wire.begin(MY_ADDRESS);                // join i2c bus with address #2
  Wire.onRequest(requestEvent);         // register event


  Serial.begin(115200);

  pinMode (injector, INPUT_PULLUP);
  pinMode (fuelgauge, INPUT);
  
  digitalWrite(SDA, 1);
  digitalWrite(SCL, 1);
  

}

void loop() {


// Fuel consumption per hour and fuel gauge sensor level are calculated in this sketch; this is working and 
// produces good plausible floating point values in the serial monitor.

}




void requestEvent(){

byte* Data;
  
 INPUT1FloatPtr = (byte*) & lPerHour;
 INPUT2FloatPtr = (byte*) & fuelRaw;

 Data[0] = INPUT1FloatPtr[0];
 Data[1] = INPUT1FloatPtr[1];
 Data[2] = INPUT1FloatPtr[2];
 Data[3] = INPUT1FloatPtr[3];

 Data[8] = INPUT2FloatPtr[0];
 Data[9] = INPUT2FloatPtr[1];
 Data[10] = INPUT2FloatPtr[2];
 Data[11] = INPUT2FloatPtr[3];

 
 Wire.write(Data,8);
           

}

Honest question at this point: Is I2C really such a “fickle beast”, or are these just beginner’s problems?

carguy: I'm running Arduino 1.7.4, so it's a fairly new version of the IDE.

It sure is. The very latest Arduino IDE is V1.6.10.

Do you have the version from "Arduino.org", instead of from "Arduino.cc"? The "Arduino.org" IDE has always had problems. If it is the one from "Arduino.org", it's well worth getting rid of it and downloading the real IDE from "Arduino.cc". (Then try your code again.)

It's available here:- Download the Arduino Software

you're right... it does say "arduino.org" on the splash screen when I start the IDE. I'll fix that ASAP.

Any thoughts on my I2C issue? :(

You have a number of problems. It is easier for me if I know a few things, but you didn't answer my questions in Reply #1. And now I also want to know what you use for pullup resistor and if you can make a photo of the wiring.

I really have to know which boards you use. Everything I write here can be wrong.

You don't need to activate the pullup resistors, you can remove that.

Arduino was split into Arduino.org and Arduino.cc. You are now on the forum at Arduino.cc. Yet you use the software of Arduino.org.

There should be no beginTransmission and endTransmission with the Wire.requestFrom. You have to remove those. If you do a Wire.requestFrom, you don't have call Wire.requestFrom twice.

The variable 'Data' is a pointer, yet you write data to that location, but there is no memory reserved there. With the newest Arduino IDE 1.6.10, it might be possible to use multiple Wire.write in the requestEvent. I have not tested that yet.

The usage of I2C is something you have to get used to, that's true. On the other hand, you have to be careful what you do, and you have to know about every code line if it is okay. You can start by answering 5 pending questions (boards? anyThing from where? grounds? pullups? photo?).

carguy: you're right... it does say "arduino.org" on the splash screen when I start the IDE. I'll fix that ASAP.

Any thoughts on my I2C issue? :(

If I were you, I'd wait until the real IDE is installed, then try again. A lot of people have trouble with their code when using that other version of the IDE.

Then let us know if the problem persists. Koepel points out some valid points that need fixing. (If so, I'd suggest that you try Nick Gammon's examples for I2C_Anything from his Send and receive any data type web-page, exactly as he presents them, and go from there.)

I was going to also mention the fact that you don't need to explicitly enable pullups on the I2C pins, but Koepel beat me to it. :D

The internal pullups are enabled automatically by the I2C library.

OldSteve: I was going to also mention the fact that you don't need to explicitly enable pullups on the I2C pins, but Koepel beat me to it. :D

The internal pullups are enabled automatically by the I2C library.

Yeah... I read that too... well, it was kind of a troubleshooting attempt... even though it probably wasn't going to be the culprit, I tried anyway, but of course it made no difference in the end.

carguy: Yeah... I read that too... well, it was kind of a troubleshooting attempt... even though it probably wasn't going to be the culprit, I tried anyway, but of course it made no difference in the end.

Anyway, as I said, don't do anything else until you have the "Arduino.cc" IDE installed, then try Nick's 'I2C_Anything' examples. Assuming they work properly, (and they should), base your code on them.

ok, I've installed the 1.6 IDE from arduino.org.

I haven't worked on fixing my I2C issues, but we'll see...

carguy: ok, I've installed the 1.6 IDE from arduino.org.

Still doing battle with the .org stuff? As mentioned, these forums are for things related to Arduino.cc

If you'd installed IDE V1.69 or 1.65 from Arduino.cc, and had that problem, it would more than likely be a hardware problem with your connections. With software from Arduino.org, who knows?

I'm sorry, I meant arduino*.cc* ... I do have V1.6 from arduino*.cc* installed now.

And at this point, I should probably also hang my head in shame, because I just figured out why I couldn't upload sketches to my breadboard Atmega until a few minutes ago. There was a jumper wire missing between the Atmega's GND and the GND rail on the breadboard :-[

I need to go do some more practical research on my car now, but I am going to try to see if I can get I2C to work now with the new IDE.

carguy: I'm sorry, I meant arduino*.cc* ... I do have V1.6 from arduino*.cc* installed now.

Good, I was hoping you'd say that it was just a typo. Which version from Arduino.cc? (1.6.?) I'm hoping it's not 1.6.10, because some people are having trouble with that one. (Still better than the ones from arduino.org though. :) ) As mentioned, v1.6.5 or V1.6.9 are the most stable recent releases. (I'm using V1.6.9, and decided not to use 1.6.10 because of the ongoing problems. I'll wait until they're all sorted out in a future release, hopefully 1.6.11.

And at this point, I should probably also hang my head in shame, because I just figured out why I couldn't upload sketches to my breadboard Atmega until a few minutes ago. There was a jumper wire missing between the Atmega's GND and the GND rail on the breadboard :-[

Not to worry, we all make that sort of mistake at times.

I need to go do some more practical research on my car now, but I am going to try to see if I can get I2C to work now with the new IDE.

At this point, it's probably best to get a very simple I2C example working first, then revisit the I2C_Anything code. Good luck. Let us know how you get on. It's midnight here, so I'm off to bed.

I wanted to test the Wire library bug fix in Arduino IDE 1.6.10. It is now possible to use more writes in the requestEvent. Please do not complain that it does not work for an older version.

// Master
// ------
//
// For: http://forum.arduino.cc/index.php?topic=415439.0
// Tested with Arduino IDE 1.6.10 and two Arduino Uno boards.
// The two boards are connected via SDA, SCL and GND.

// I2C_Anything from : http://www.gammon.com.au/i2c

#include <I2C_Anything.h>

const int slaveAddress = 2;

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

  Serial.println(F( "Master"));
  
  for( int i=0; i<100; i++)
    Serial.println(F("This will only work with Arduino.cc IDE 1.6.10 or newer"));

  Wire.begin();
}

void loop() 
{
  float fuel_consumption;
  float fuel_gauge;
  int battery;
  
  // Request two floats and a integer, that makes 10 bytes.
  int n = Wire.requestFrom(slaveAddress, 10);
  if( n == 10)          // is the number of bytes received that was requested ?
  {
    I2C_readAnything( fuel_consumption);
    I2C_readAnything( fuel_gauge);
    I2C_readAnything( battery);

    Serial.print(F("Received :"));
    Serial.print( fuel_consumption);
    Serial.print(F(", "));
    Serial.print( fuel_gauge);
    Serial.print(F(", "));
    Serial.print( battery);
    Serial.println();
  }
  else
  {
    Serial.println(F( "Fail"));
  }
  delay(2000);
}
// Slave
// -----
//
// For: http://forum.arduino.cc/index.php?topic=415439.0
// Tested with Arduino IDE 1.6.10 and two Arduino Uno boards.
// The two boards are connected via SDA, SCL and GND.

// I2C_Anything from : http://www.gammon.com.au/i2c

#include <I2C_Anything.h>

const int slaveAddress = 2;

volatile float fuel_consumption;
volatile float fuel_gauge;
volatile int battery;


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

  Serial.println(F( "Slave"));

  for( int i=0; i<100; i++)
    Serial.println(F("This will only work with Arduino.cc IDE 1.6.10 or newer"));

  Wire.begin( slaveAddress);            // Join I2C bus with this address
  Wire.onRequest( requestEvent);         //
}

void loop() 
{
  float fuel_c;
  float fuel_g;
  int bat;

  // Gather the information and calculate the values.
  fuel_c = 123.45 + (float) random( 71);  // simulate a value with some random as noise.
  fuel_g = 200.02 + (float) random( 97);  // simulate a value with some random as noise.
  bat = 10 + random( 5);                 // simulate a value with some random as noise.

  
  // Fill the volatile variables when the interrupts are turned off.
  // To avoid that the requestEvent occurs while a variable is only half written.
  noInterrupts();
  fuel_consumption = fuel_c;
  fuel_gauge = fuel_g;
  battery = bat;
  interrupts();

  delay( 1000);
}

// In Arduino 1.6.10 it is possible to use more writes in requestEvent.
void requestEvent()
{
  I2C_writeAnything( fuel_consumption);
  I2C_writeAnything( fuel_gauge);
  I2C_writeAnything( battery);
}

I’m waiting for the first person who tries this with an older version and complains that it is not working…

I’ve tried to compile this and get this error on both

Detecting libraries used...
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Steve\AppData\Local\Temp\build6bde95a96ec1e87d0602f28f7c3ddb96.tmp\sketch\slave_new.ino.cpp" -o "nul"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Steve\AppData\Local\Temp\build6bde95a96ec1e87d0602f28f7c3ddb96.tmp\sketch\slave_new.ino.cpp" -o "C:\Users\Steve\AppData\Local\Temp\build6bde95a96ec1e87d0602f28f7c3ddb96.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\Steve\Documents\Arduino\slave_new\slave_new.ino:11:26: fatal error: I2C_Anything.h: No such file or directory

 #include <I2C_Anything.h>

                          ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

Yes I have the latest version installed and have the I2C_anythig library installed in this path C:\Users\Steve\Documents\Arduino\libraries\I2C_Anything and I’ve even deleted the folder and copied the I2C_Anything.h into the same folder as the slave code
Not sure what I’m doing wrong

You can copy it in the same folder as your sketch if you include it with double quotes instead of < and >

#include "I2C_Anything.h"

I forgot to mention that I use linux. It seems that others in Windows have more problems with 1.6.10.

The Arduino IDE should be able to find the “I2C_Anything.h” in the “I2C_Anything” folder in the user “libraries” folder. Can you check that folder again ? is the file is there ?
You might have to restart the Arduino IDE if you add or remove files outside the Arduino IDE.

Koepel:
You can copy it in the same folder as your sketch if you include it with double quotes instead of < and >

#include "I2C_Anything.h"

I forgot to mention that I use linux. It seems that others in Windows have more problems with 1.6.10.

The Arduino IDE should be able to find the “I2C_Anything.h” in the “I2C_Anything” folder in the user “libraries” folder. Can you check that folder again ? is the file is there ?
You might have to restart the Arduino IDE if you add or remove files outside the Arduino IDE.

I have checked for the file and it’s in the folder I’ve even moved it into main library and each time restarted the IDE every time I moved it, I think the latest version has lots of error’s I’ve tried to recompile some other programs that worked before and now they give error’s I think I will revert back to the one I used last time.
This is one that will not compile a battery monitor from the 4x4 forum

Detecting libraries used...
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp" -o "nul"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp" -o "nul"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp" -o "nul"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.cpp" -o "nul"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp" -o "nul"
Generating function prototypes...
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp" -o "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp" -o "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\sketch\MonitorV1_3.ino.cpp.o"
Compiling libraries...
Compiling library "LiquidCrystal"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.cpp" -o "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\libraries\LiquidCrystal\LiquidCrystal.cpp.o"
Compiling library "EEPROM"
Compiling core...
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -x assembler-with-cpp -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\wiring_pulse.S" -o "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\core\wiring_pulse.S.o"
"C:\Users\Steve\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\WInterrupts.c" -o "C:\Users\Steve\AppData\Local\Temp\build08dd391a0f8cd4f62b9b3691c752da29.tmp\core\WInterrupts.c.o"
cc1.exe: error: -fno-fat-lto-objects are supported only with linker plugin.

Using library LiquidCrystal at version 1.0.5 in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal 
Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM 
exit status 1
Error compiling for board Arduino/Genuino Uno.

I get this error on a few I’ve tried cc1.exe: error: -fno-fat-lto-objects are supported only with linker plugin.