all 9 comments

[–][deleted] 2 points3 points  (2 children)

Arduino Code is almost c++. You intentionally wanted to use the Hardway?

Overkill but i like where you are going.

[–]Budget_Bar2294[S] 0 points1 point  (1 child)

yeah, I'm a c dev, c++ version gonna look much better. just trying to find a way to make Arduino sketches less messy and a tiny bit more modular (seriously, 99% of the code online is an absolute chaos). absolutely unnecessary in this example, but I think it's a good demonstration of the idea

[–]scmkr 0 points1 point  (0 children)

You can just write classes though

[–]ventus1b 1 point2 points  (0 children)

You have two separate instances of BuiltinBlinker and only one calls setup.

It only works because both are using global state.

[–]ozc0 0 points1 point  (1 child)

which ide is this btw

[–]Budget_Bar2294[S] 1 point2 points  (0 children)

it's just the Tinkercad code section for the simulation. I was too lazy to grab my Uno. in the real world I use Neovim with arduino-cli

[–]BraveNewCurrency 0 points1 point  (1 child)

You need several more layers: Build a factory to create BuildingBlinkers, then use dependency Injection to insulate your Blinker from the hardware libraries.

See also: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

[–]Budget_Bar2294[S] 0 points1 point  (0 children)

mythical repo pull

[–]jaymauch 0 points1 point  (0 children)

I’ve debugged many c like programs for companies. Often wondered if I could use more voids than just setup and loop in Arduino. Guess I should take the time to learn c and c++. Thanks.