void Ledparpar(int pulsador, int led) {
// put your main code here, to run repeatedly:
for ( int i=0; i<8; i++) {
digitalWrite(LED, HIGH);
delay(300);
digitalWrite(LED, LOW);
delay(300);
If pin reads high, declare a void function Ledparpar() and directly forget this declaration,
else compare the same pin with low and throw away the result (a true value).
That is not how you call a function, your if/else usage is strange.
The following should work better:
if (digitalRead(PULSADOR) == HIGH) {
Ledparpar();
}
void is used when defining the function, not when calling it.
digitalRead(PULSADOR) is a read function and using == LOW will not Change the pin at all.
You mention Interrupts... I don't see any reference to Interrupts in the code. I assume you have pin PULSADOR implemented in Hardware but you don't seem to use it in any way related to Interrupts.
The Arduino language is case sensitive. PULSADOR and pulsador are two totally different variables but are confusing. Please consider using separate names.
Why pass the pulsador Parameter to the function Ledparpar if it isn't used?
Case sensitive - Problem 4 applies to LED/led as well.
The function Ledparpar is defined as expecting two Parameters. You call it with None.
UKHeliBob, Whandall, JaBa
I have - and no joke - 4 days programming with arduino; This is my sixth program, thanks to uKHeliBob, Whandall, JaBa your comments have helped me a lot, the program already works. THANK YOU.
Regarding AWOL, which says his presentation is moderator, I just have to tell you that not everyone we started as experts, and if you did not understand the title of my post you have to be a beginner like me; There were those who understood and solved the problem. Thank you friends.
Well, that's put me in my place.
Would you deign to share the meaning of ...oh, wait, 0.007 - it's a James Bond reference (I think)
(If it's any help, I'm certainly not any kind of of Arduino expert)
There were those who understood and solved the problem.
There are those that ignored the useless post title, and only looked at the code. The rest of use went WTF when reading the post title, and assumed that, since the thread topic was unrelated to the problem, that you were either an idiot or a troll, and didn't bother reading the code/typing a reply.
You REALLY don't want to foster that impression, do you?
If not, you can stop digging, and explain how the thread title relates to your problem.