the libraries and the main class file

Hello

How can I get access to the standard functions (like digitalWrite(), delay() etc. in another custom class?

If I could include these somehow?
these function calls in the main file (.pde) are not used through an instance either? ( xxx.delay() , so you have no option to send it to a constructor to make use of the basic functions in another class.

so Im wondering how can I use them in my own custom classes.

The other standard libraries can be included and used as I can see.

are these really only available in the main (pde) class ( the setup() loop() class) ?

I have not had an issue using those in my libraries. Are you having a specific issue?

hmm..

I get errors indicating access to these functions..

Blinker.cpp:8: error: 'HIGH' was not declared in this scope
etc.

I have a separate Blinker.cpp and Blinker.h files that i include in the main file. instantiation works fine. Blinker b;

should these functions be available straight on?

HIGH is not a function. It is #defined in wiring.h, which is included by WProgram.h, which is included by the sketch automagically, but is not included in your class, but needs to be.

thought I could provide the code, should be easier to understand the issue, I simply try with using the basic blink example.

main file..

#include "Blinker.h"
#include "Blinker.cpp"
 
Blinker b;

void setup() 
{                
  pinMode(13, OUTPUT);     
}

void loop() 
{
  b.Blink();
}

Blinker.h code..

using namespace std;
 
class Blinker
{
  public:
    Blinker();
    void Blink(); 
};

Blinker.cpp code..

#include "Blinker.h"

Blinker::Blinker()
{
}

void Blinker::Blink()
{
  digitalWrite(13, HIGH);   // set the LED on 
  delay(20*i);              // wait for a second 
  digitalWrite(13, LOW);    // set the LED off 
  delay(20*i);              // wait for a second      
}

forget my last post!

PaulS: thank you. this is what I was looking for! it works like expected now, I did not find any docs on were to find them (WProgram.h).

(ps. I meant the HIGH/LOW constants + all functions that I couldn't access)

:slight_smile:

I did not find any docs on were to find them (WProgram.h).

On windows, you can navigate to the folder where the Arduino IDE is installed, and open the search function. Type the name of the function/constant in the text field, and let the OS find the file for you. That's what I did.