Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • if you write an answer, why you don't try it? the cast to int doesn't compile Commented Apr 19, 2019 at 10:19
  • @Juraj Strange. Line digitalWrite(9, (int)!digitalRead(8)); works perfectly in Tinkercad. Commented Apr 19, 2019 at 10:21
  • for megaAVR core (Uno WiFi 2) with PinStatus enum? Commented Apr 19, 2019 at 10:27
  • @Juraj You got me. I was reading wrong source code, and tested it on wrong simulator. Post answer about using ternary operator and I will delete mine. Commented Apr 19, 2019 at 10:36
  • cast to PinStatus could work. it compiles, but I would like to know if it works. but I don't have a board which would use the updated Arduino API. but the enum could be tested on it's own. Commented Apr 19, 2019 at 10:40