6 ms·
A lot of people look down on the arduino ecosystem because "it's for beginners", but there is no benefit to complexity for complexities sake. If your product n
by londons_explore 4y ago
A lot of people look down on the arduino ecosystem because "it's for beginners", but there is no benefit to complexity for complexities sake.
If your product needs to do X, Y, and Z, and that can be built in arduino in a few days, and built in some other "professional" toolchain in a few months, then you will save money by building your real product on arduino.
And when the thing you're doing is outside the scope of what arduinos library ecosystem can provide (eg. you need to drive some GPIO pin with cycle accurate latencies), you can still write your assembly to do it.... But you still get the benefits of simplicity for the rest of your functionality.
- Denvercoder9 4y ago> And when the thing you're doing is outside the scope of what arduinos library ecosystem can provide (eg. you need to drive some GPIO pin with cycle accurate latencies), you can still write your assembly to do it.... But you still get the benefits of simplicity for the rest of your functionality. In my experience, escaping the Arduino system isn't so simple. The Arduino framework pulls a lot of stuff into the global namespace when you include even just one of their headers, some of which is incompatible with standard C++. For example they `#define` all pin names, some of which can be common terms like `led`, `button`, `mosi` or `clk`. Any of those you then can't use a variable name. It's even worse because the pin names differ between boards, and there's no master list of defined terms.
- justeleblanc 4y agoAll the defines for pin names are fully uppercase. Is it really such a hindrance not to be able to call your variable LED_BUILTIN or CLKPS1?
- Denvercoder9 4y agoNot all pins have names that are so specific, and it's a common convention to uppercase e.g. enumerators.
- an-unknown 4y ago> If your product needs to do X, Y, and Z, and that can be built in arduino in a few days, and built in some other "professional" toolchain in a few months, then you will save money by building your real product on arduino. Not necessarily. This is only true if you only think about software. Your "real product" also consists of hardware, and if you can do X, Y, and Z on a certain chip with the Arduino environment, you can most likely do exactly the same on a smaller and cheaper chip without the Arduino environment. Simply replacing Arduino C++ by plain C code without useless abstractions can already give you a very noticeable performance improvement and code size reduction on small microcontrollers. Development time is essentially a one time investment, while the chip price is a fixed cost for every unit you build. It's purely a question of how many units you want to build in the end. And for the record, if you can build it in an Arduino environment within a few days, you can definitely build it in "some other 'professional' toolchain" in just a few more days at most.
- IshKebab 4y ago> A lot of people look down on the arduino ecosystem because "it's for beginners", but there is no benefit to complexity for complexities sake. It's possible to be beginner friendly and not badly designed. Unfortunately Arduino doesn't really achieve that. The Arduino API is pretty terrible, the "IDE" is awful (they did improve it a lot recently in fairness), and the boards are very expensive. Mbed is better in pretty much every way except that they screwed around with several different rubbish build systems for years, which meant it was very difficult to set up and as a result very beginner unfriendly. But the actual APIs are a lot nicer than Arduino's. They do finally have a good IDE (Mbed Studio, based on Theano). I would probably use that for new microcontroller projects.
- iamflimflam1 4y agoI would recommend to anyone using the arduino framework to switch to PlatformIO. It’s just a plugin for VSCode so you have all the benefits that come with that ecosystem. Arduino is great if you are happy with one single massive file for all your code (I know you can add additional files, but it’s not intuitive). For large projects that needs to be split up and architected use platformio.
- zozbot234 4y agoThe whole point of the rust-embed ecosystem is to bring the ease of use found in something like Arduino to embedded development more generally. Upstreaming ESP support in LLVM (what the OP is about) is a key part of this.
- FpUser 4y agoLooking at my firmware code, 4 quadrant motor torque control in particular. It is plain C and at the level it is written I really doubt C++ / Rust would add any value. For all the horror safety stories: firmware runs on whole bunch of devices for close to 10 years already without single fault caused by whatever bug there might be. Obviously not advocating plain C for business middleware servers. Those benefit greatly from C++ type of languages.
- fleventynine 4y agoMore and more firmware is using complex protocols like TCP/IP and TLS, which are risky to implement in a memory-unsafe language. Embedded Rust is very attractive for those applications.
- pjmlp 4y agoIt already exists for those willing to broaden their horizons to Python, Basic, Pascal, Java, TinyGo, Oberon-07 and .NET. Naturally having Rust as well is a positive, the more the merrier.
- DigitalBison 4y agoThis is exactly where I'm at. I'm a professional SDE and I'm pretty damn good at writing code and solving problems at all kinds of different levels of complexity and abstraction, although professionally I mostly write Java code and build web services and that kind of thing. When I got into electronics and embedded development recently as a hobby, I started with Arduino. And for the vast majority of my projects, which are mostly simple smarthome IOT type things, or little toys for my kiddo, the Arduino framework is just fine and the ecosystem of libraries is great. But when I recently started a project that was much lower-level (in fact, it was your example exactly -- driving pins with cycle-accurate timing), where I didn't need those libraries, I used ESP-IDF without Arduino. I'm also just lazy, and just don't want to deal with more complexity than I have to.
- stavros 4y agoHow was your experience with ESP-IDF? I've only used Arduino so far (I've basically had exactly the same experience as you), and haven't needed anything more, but I've been thinking of using the IDF for my next project, since I can't use Rust yet.
- skupig 4y ago>there is no benefit to complexity for complexities sake Arduino is added complexity. In my limited hobbyist experience, going to the datasheets and using official toolchains has been very straightforward. It pays to build the understanding ahead of time rather than debugging some random person's Arduino library when your peripheral stops working.
- jbaczuk 4y agoYep. You think you can get by without understanding what the Arduino libraries are doing under the hood, until you can't. Then you wasted all that time. I'm just as guilty as anyone spending just as much time avoiding learning something, than just taking the time to learn it.
- sircastor 4y agoIt used to be that official tools chains were a huge money and time expense - Not to mention requiring substantial understanding before you even got to them. Even AVRs which had an open source tool-chain still required a $50-200 programmer to get started. The PICs were more popular, but proprietary tool-chain. And the communities associated with both were great at gatekeeping and dismissive of beginners who weren't doing things "the right way'. Arduino's added complexity opened up the space to people who had little-to-no programming experience. People who had a computer with a USB port. People who had no familiarity with binary let alone hexadecimal to set a bitmask so they could turn an LED on. Let alone figure out which bits to flip to set a timer. Arduino is added complexity to the benefit of accessibility. The complexity of the datasheets and toolschains make most products an unassailable wall. That said, the real gem of Arduino is its community that is welcoming and helpful to beginners.
- ilyt 4y ago> If your product needs to do X, Y, and Z, and that can be built in arduino in a few days, and built in some other "professional" toolchain in a few months, then you will save money by building your real product on arduino. I'd hazard a guess there is no software that would take "months" to build while it takes days on arduino, unless you count "developer learning C++ properly" in that month. Most uC platforms provide enough SDK and code generation that you can hit the ground running with simple code and complex code won't be any easier in arduino