Coding Functions & Variable Scope

preview_player
Показать описание
Learn about function definitions and variable scope in this programming lesson for beginners.

Check out the full course here:

Have a comment or suggestion? Contact me via:

Рекомендации по теме
Комментарии
Автор

I don't know if this is the right place to ask... but I'm gonna ask... is there a simpler way to write if (!digitalRead(buttonPin1[0]) == HIGH) {
count = 1;
}
else if (!digitalRead(buttonPin1[1]) == HIGH) {
count = 2;
}
else if (!digitalRead(buttonPin1[2]) == HIGH) {
count = 3;
}
I want a simpler bit of code that spits out a number of which button is pressed without writing a massive long list of 'else if's'. Just wondering. Any help would be greatly appreciated.

sirkristoferTV
welcome to shbcf.ru