Go Down

Topic: add new function to wiring_digital.c (Read 6 times) previous topic - next topic

BKNio

Hello!
I am trying to add new function "MydigitalWrite" to wiring_digital.c () (\arduino-0017\hardware\cores\arduino)

When I try to compile:
In function 'void loop()':
error: 'MydigitalWrite' was not declared in this scope

How to win this problem?




retrolefty

#1
Jan 22, 2011, 08:03 pm Last Edit: Jan 22, 2011, 08:06 pm by retrolefty Reason: 1
Hello!
Quote
I am trying to add new function "MydigitalWrite" to wiring_digital.c () (\arduino-0017\hardware\cores\arduino)

When I try to compile:
In function 'void loop()':
error: 'MydigitalWrite' was not declared in this scope

How to win this problem?


There should be no reason to modify the core function in the wiring library.

Just write your new function directly following the loop() function in your sketch:

void MydigitalWrite( int argument1, int argument2, etc.)
{
  //your new code
  // more code
}

Then you can use your new function anywhere in the setup or loop function of your sketch.

Lefty

BKNio

there is one reason
standart digitalwrite spends a lot of time to switch on or switch of massive of pins
i think i can do it, if i modify standart digitalWrite

Coding Badly


Why do you want to modify digitalWrite?  To make it faster?

BKNio

No. i want create new to switch on or off massive of pins
i cant use like this
Code: [Select]

for(int i=0;i<10;i++)
{
digitalWrite(i,HIGH);
}
because it spend a lot of time

Go Up