}}}
Change the delay(100) to delay(scanDelay)
Define a global int variable scanDelay
Wire up your menbrain pad to any four spare input pins, but not 0 or 1, and connect the common line of the pad to ground. In the setup function use pinMode to make these pins inputs and use INPUT_PULLUP
To enable the internal pull ups.
Look at what button is pressed and use a switch statement structure to change the variable scanDelay to a number that gives you the delays you want.
The first think to do is learn how switches work with your Arduino. Study and use the sample procedure and program at: https://www.arduino.cc/en/Tutorial/DigitalReadSerial. Use you 4 switch pad and one of the pads. Then modify that program to use all 4 switches and get that to work.
Once you understand how the switch pad works with a program, you will be able to figure out what to add to your radio program.
Paul
stil
Bassinbc:
still confused on where to add pin mode
Look at just about any example sketch
in the IDE using digital input.
Still
Bassinbc:
still confused on where to add pin mode
From reply #1
. In the setup function use pinMode to make these pins inputs and use INPUT_PULLUP
What part of “in the setup function” are you having trouble with?
you have to hold down on the keypad to keep it on and when you let it go it's off
That is what you have written the code to do.
If the button is pressed do one thing and if it is not do another. So yes that is what it does.
If you want the effect to stick then do not use the else.
what
In the loop function.
Remove all the current code after the else, and duplicate the code before it only reading a different button first. So for four buttons that will mean another three lumps of code that look like the first one but have different numbers in the frequency selection bit.
i tho
Hello
Hello
}
}
buttonState = digitalRead(2);
You've given pin 2 a nice name; why aren't you using it?
Please remember to use code tags when posting code.
for ( int i = 1100 ; i >= 750 ; i-- ) {
float freq = i / 10.0 ;
radio.setFrequency(freq); // pick your own frequency
delay(100);
}
You've got this code more than once - why isn't it in a function?
t
So? That's what parameters are for.
What about the pin name?
What part of :-
If you want the effect to stick then do not use the else.
Do you not understand?
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
You need to detect WHEN the button goes from LOW to HIGH, when it is pressed to change the delay, NOT WHILE the button is pressed.
Look up "change of state arduino" to find sample code for momentarily pressing a button.
Thanks.. Tom...
H