Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Dealing with complex/ feature rich logic for Embedded
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Dealing with complex/ feature rich logic for Embedded

by ADearUser on Sat Apr 17, 2021 10:55 am

Good morning!

I'm a kind of an entry level hardware hacker, but I have lots of experience writing software (especially Ruby, Python, Javascript, and surprisingly I'm starting to like Java now didn't see that coming, thanks 2020). Anyway, I've taken on my first "complex" hardware project ever, I'm building an amazing water irrigation controller with my sister based on the Low-cost irrigation controllers: Arduino section of that link.

Anytime I write something complex, I like to have unit tests for my work because I can make wild and crazy changes to my code that I know don't destroy any of my software's functionality because I can run my tests and see that everything actually still works. Anyone have any tricks for unit testing Arduino C++? Along those lines of facing complexity head on, is anyone using an alternative language like Rust (if that can compile to an Arduino Mega that's really appealing). I kind of assume CircuitPython is pretty/ more unit-test friendly but haven't actually gotten my feet wet there (plus I'm on this out of character statically typed language binge lately, I think due to all the Java I've been up to lately).

ADearUser
 
Posts: 94
Joined: Thu Mar 12, 2015 11:07 am

Re: Dealing with complex/ feature rich logic for Embedded

by dastels on Sat Apr 17, 2021 1:13 pm

Sorry about the Java.

"Test Driven Development for Embedded C" by James Grenning is the book I recommend.

Dave

dastels
 
Posts: 6095
Joined: Tue Oct 20, 2015 3:22 pm

Re: Dealing with complex/ feature rich logic for Embedded

by ADearUser on Sun Apr 18, 2021 5:54 pm

Thanks, I wouldn't have stumbled across that book otherwise. I'm just going to dump all my tabs on the subject from yesterday I think I have just enough to go forwards but may grow this (I sometimes come back to these threads as a refresher).

- Test Driven Development for Embedded C (free TOC!)
- Platformio has two modes of testing, 1 that actually runs on the board, and another that's more unit-testlike using the 'native PC' platform, so [inline]pio test -e native[/inline] will run your unit tests
- class reference
- Reall long SO discussing the need for mocking
- Rust can compile for Arduino but I think it's an uphill battle getting anything other than fairly generic h/w to work with it since you can't use existing dependencies written in C (as far as I can tell)
- ArduinoFake for mocking and asserting interactions with pins

ADearUser
 
Posts: 94
Joined: Thu Mar 12, 2015 11:07 am

Please be positive and constructive with your questions and comments.