Pages: [1]   Go Down
Author Topic: Error when convert sketch from xx.pde too xx.ino  (Read 919 times)
0 Members and 1 Guest are viewing this topic.
The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//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.

* BMP085.cpp (7.48 KB - downloaded 26 times.)
* BMP085.h (2.5 KB - downloaded 14 times.)
* SHT1x.cpp (5.86 KB - downloaded 18 times.)
* SHT1x.h (0.98 KB - downloaded 10 times.)
« Last Edit: December 06, 2012, 04:03:46 am by Coding Badly » Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All,

More attachements for the library.

Jack

* LiquidCrystal_I2C.cpp (8.09 KB - downloaded 25 times.)
* LiquidCrystal_I2C.h (3.27 KB - downloaded 20 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* LiquidCrystal_I2C.cpp (8.09 KB - downloaded 60 times.)
* LiquidCrystal_I2C.h (3.27 KB - downloaded 12 times.)
Logged

The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

All the errors are solved!

Jack
Logged

Pages: [1]   Go Up
Jump to: