Skip to main content
added 60 characters in body
Source Link

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called


You may also use this definition:

void digitalWrite(double P, int8_t V)
{
  Serial.print("wrap digitalwrite");
  //digitalWrite(P,V); Calling it even with (int) P will cause a recursive loop 
}

But in-order to use it you need to define a variable with double type:

double pin;
pin = 13;
digitalWrite(13,1);

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called


You may also use this definition:

void digitalWrite(double P, int8_t V)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

But in-order to use it you need to define a variable with double type:

double pin;
pin = 13;
digitalWrite(13,1);

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called


You may also use this definition:

void digitalWrite(double P, int8_t V)
{
  Serial.print("wrap digitalwrite");
  //digitalWrite(P,V); Calling it even with (int) P will cause a recursive loop 
}

But in-order to use it you need to define a variable with double type:

double pin;
pin = 13;
digitalWrite(13,1);
Improved answer
Source Link

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called


You may also use this definition:

void digitalWrite(double P, int8_t V)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

But in-order to use it you need to define a variable with double type:

double pin;
pin = 13;
digitalWrite(13,1);

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called


You may also use this definition:

void digitalWrite(double P, int8_t V)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

But in-order to use it you need to define a variable with double type:

double pin;
pin = 13;
digitalWrite(13,1);
Source Link

"Maybe" using the c++ "functions overriding" feature can help

void digitalWrite(uint8_t P, int8_t V, bool _wrap)
{
  Serial.print("wrap digitalwrite");
  digitalWrite(P,V);
}

Thus, if you call in you main application:

digitalWrite(pin_button, 1, 0); 

The wrapped version will be called

and if you used this:

digitalWrite(pin_button, 1); 

The original one will be called