Go Down

Topic: Own header file, problem finding the function inside the program (Read 66 times) previous topic - next topic



I have made my first little header file and Cpp file. Great! but not so great because when I compile a little test program the program returns this error:

sketch_jan11g:10: error: 'Store_Value_To_Eprom' was not declared in this scope

CPP file is like this:

#include "EL_Boat.h"
#include "Arduino.h"

#include "EEPROM.h"

void EL_Boat::Store_Value_To_Eprom(int Eprom_Value_To_Store, int Adress_LSB, int Adress_MSB)
    if(Eprom_Value_To_Store >= 256)
        Eprom_Value_To_Store -= 255;
        EEPROM.write(Adress_LSB , Eprom_Value_To_Store);
        EEPROM.write(Adress_MSB, 255);

#ifndef EL_Boat_h
#define EL_Boat_h

Header file like this

#include "Arduino.h"
#include "EEPROM.h"

class EL_Boat
    void Store_Value_To_Eprom(int Eprom_Value_To_Store, int Adress_LSB, int Adress_MSB);
    int Eprom_Value_To_Store;
    int Adress_LSB;
    int Adress_MSB;
    int _Eprom_Value_To_Store;
    int _Adress_LSB;
    int _Adress_MSB;


Anyone can help me with the error?



forgot to put in the program:

#include <EL_Boat.h>

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
Store_Value_To_Eprom(10, 10,10);


Code: [Select]
void loop() {
  // put your main code here, to run repeatedly:
Store_Value_To_Eprom(10, 10,10);

Don't do that - you'll burn out the EEPROM address really quick.

Read the location, and only update it if the value needs to change.  Will be quicker too, as writing requires 3.3ms, while read/do nothing goes real quick.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Yes I know,

This is only to se if the program works.

I will eventially use it in another program.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131