You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am just getting into working with microprocessors but had C++ class about 25 years ago.
This code example is perfect for a fun project that I am working on.
I am wondering about one piece of code in the button section that I am not quite sure what the C++ code is doing with the == in this context.
bool pressed = reading == LOW;
Aside for this, the explanations were great.
If you want to take this example further; it would be interesting to have two buttons with associated LEDs along with a counter that that compares how much one LED has been "ON" verses the other. This could be an interesting game were two people get on the web page and try to have their light "ON" for more than the other person. They would have to alternate between trying to turn "ON" their LED while turning "OFF" the other LED.
The text was updated successfully, but these errors were encountered:
If we agree that C has lowest precedence for the assignment statement (=), then the code will first check to see if reading is LOW and the result which is true or false is assigned to pressed.
I am just getting into working with microprocessors but had C++ class about 25 years ago.
This code example is perfect for a fun project that I am working on.
I am wondering about one piece of code in the button section that I am not quite sure what the C++ code is doing with the == in this context.
bool pressed = reading == LOW;
Aside for this, the explanations were great.
If you want to take this example further; it would be interesting to have two buttons with associated LEDs along with a counter that that compares how much one LED has been "ON" verses the other. This could be an interesting game were two people get on the web page and try to have their light "ON" for more than the other person. They would have to alternate between trying to turn "ON" their LED while turning "OFF" the other LED.
The text was updated successfully, but these errors were encountered: