Go Down

Topic: Error when convert sketch from xx.pde too xx.ino (Read 1 time) previous topic - next topic

jack100

Dec 06, 2012, 10:02 am Last Edit: Dec 06, 2012, 10:03 am by Coding Badly Reason: 1
Hi all,

I wrote a Arduino sketch for version 0023. It's works well. Now I update too version 1.0.2. Change the extension of the sketch from xx.pde too xx.ino
But when I compile I get errors.
Who can help me?

Jack

Below the sketch:

Code: [Select]
//Weerstation

#include <LiquidCrystal_I2C.h>
#include <SHT1x.h>
#include <Wire.h>
#include <BMP085.h>
BMP085 bmp;
 
// Specify data and clock connections and instantiate SHT1x object
#define dataPin  4
#define clockPin 5
SHT1x sht1x(dataPin, clockPin);

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display

void setup()
{
 bmp.begin();

 lcd.init();                      // initialize the lcd
 lcd.begin(20,4);
 lcd.clear();    
 lcd.backlight();
}
 
void loop()
{    
 float temp_c;  
 float humidity;

 // Read values from the sensor
 temp_c = sht1x.readTemperatureC();  
 humidity = sht1x.readHumidity();

 // Print the values to the serial LCD
 lcd.setCursor(0,0);  //1ste rij LCD
 lcd.print("T1 ");  //Temperatuur binnen
 lcd.print(temp_c, 1);
 lcd.print((char)223);  //Graden symbool
 lcd.print("C");
 
 lcd.setCursor(11,0);  //1ste rij LCD  
 lcd.print("RV1 ");   //Luchtvochtigheid binnen
 lcd.print(humidity, 1);
 lcd.print("%");

 lcd.setCursor(0,2);  //3de rij LCD  
 lcd.print("LD ");   //Luchtdruk
 lcd.print((bmp.readPressure()/100)+1);
 lcd.print("mBar");
     
 delay(5000);
}



Moderator edit: [code] [/code] tags added.

jack100

Hi All,

More attachements for the library.

Jack

Grumpy_Mike

It would help if you posted the errors and read the sticky topic in this section.

jack100

When I compile the sketch I get the next errors:

In file included from Weerstation.ino:5:
R:\Mijn Documenten\Arduino\libraries\Weerstation/SHT1x.h:15:22: error: WProgram.h: No such file or directory
In file included from Weerstation.ino:4:
R:\Mijn Documenten\Arduino\libraries\Weerstation/LiquidCrystal_I2C.h:81: error: conflicting return type specified for 'virtual void LiquidCrystal_I2C::write(uint8_t)'
R:\Mijn Documenten\Program Files\Arduino\arduino-1.0.2\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

Jack

Grumpy_Mike

That is covered in the sticky topic I told you to read. Have you read it?
Why have you not modified you original post to include code tags.

jack100

I haven't read the sticky topic.
I don't have experience with programming.
Therefore I have only change the extension of the sketch from .pde to .ino

Jack



Grumpy_Mike


I haven't read the sticky topic.
I don't have experience with programming.
Therefore I have only change the extension of the sketch from .pde to .ino

Well if you are not willing to read the sticky which tells you what to do then why should I repeat that information.
The fact that you don't have any programming experience does not prevent you from reading does it?
You have to change a file in the libary and the sticky tells you what.

jack100

Some errors I have tackled.

Only this 2 errors continue:
R:\Mijn Documenten\Arduino\libraries\Weerstation\LiquidCrystal_I2C.cpp:219: error: prototype for 'void LiquidCrystal_I2C::write(uint8_t)' does not match any in class 'LiquidCrystal_I2C'
R:\Mijn Documenten\Arduino\libraries\Weerstation\/LiquidCrystal_I2C.h:81: error: candidate is: virtual size_t LiquidCrystal_I2C::write(uint8_t)

Jack

PaulS

That one is covered, too. The LiquidCrystal_I2C hasn't been updated for 1.0+ use. Edit the header file for the library, and change the return type of the write() method from void to size_t. Edit the source file and make the same change. At the end of the write() method add a return statement to return a value, usually 1.

jack100

Paul,

I don't understand exactly what you means.

Here the 2 files. LiquidCrystal_I2C.h and LiquidCrystal_I2C.cpp
Paul, will you change both files for me?

Jack


Go Up