I’m having moderate but not complete success with an app I’ve written.
The app should flash LED 6, unless I press the corresponding button 3, in which case it stops the flashing cycle, emits a different color during the duration of the button press, and publishes the state change.
I think this is a pretty basic question but my code doesn’t seem to work:
I’d rather say the else if() can never be true since else is only ever the case when the if() is not
If you replace the else for an inverse if() your else if() would read like this
// reworded else if
if ((b.buttonOn(3) != true) && (b.buttonOn(3) == true))
// this will never happen ;-)
// unless you are exceedingly quick to switch the button between the two function calls ;-)
@charlietokowitz there are a couple of alternate ways that you can share code in the forums:
If it is a short snippet, paste your code into the compose window and click on the button in the formatting bar (</>)
If it is a long code block, you can create and link to a “gist”, or a code snippet hosted on GitHub. They’re free to make, and format well within Discourse.