Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
DaveedMember
Wow, that is perfect, thanks.
That code seems pretty straight forward and does what I want, a simple echo.When I tried this code for the buttons to increment the delay:
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
}
...
loop() {
if (digitalRead(5) == LOW) {
delay++;
}
if (digitalRead(6) == LOW) {
delay--;
}
...
}I get:
“error: ISO C++ forbids incrementing a pointer of type ‘void (*)(long unsigned int)'”
but I changed to:
Global variable
int a = 25; // make a variable I can control with buttons and ++
setup() {
...
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
}
...
loop()
delay(300);
// echoDelay is number of memory slots back into the past to read for the echo.
// must be a factor of 3 because we pack 2 samples into each 3-byte sequence of SRAM.
int delayValue = 3 * a; //mulyply by 3 for 3-byte SRAM
echoDelay = analogRead(0) * delayValue;
{
if (digitalRead(5) == LOW) {
a++;
}
if (digitalRead(6) == LOW) {
a--;
}
// code for two buttons press at the same tim
if (digitalRead(5) == LOW && digitalRead(6) == LOW){
Serial.println();
Serial.print("BOTH SWITCHES");
Serial.println();
}
}
and that works well.
Although I am sure they are more elegant ways to do that.Do you think is possible just to query the system to get the delay value to the LCD ? Pressing both buttons, for example, just to send the data to the LCD once, without affecting the the delay too much
DaveedMemberOk, I found my own answer. The shield only uses Digital pins 5-13.
I think
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)