Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

F072Oofg145Rves.Medium
Good Instructable for the advanced folks out there, your code won’t be portable, but you’re advanced, so whatever :) RazorConcepts writes-

Arduino is slow? What? This instructable will show just how slow a part of Arduino is, and how to fix it. It’s true – more specifically, Arduino’s digitalWrite command takes a considerable amount of time. If you are just switching on a LED once or something, you won’t be able to notice it. However, I realized how slow it was while I was trying to use a TLC5947 PWM driver. That requires the microcontroller to shift in 288 bytes each time! Each byte required about 12 digitalWrites, for a total of 3456 digitalWrites each time I wanted to shift in new data to the TLC5947. How long did that take? 30 seconds of just digitalWrite! But there is a solution – using “true c” style commands, or what the AVR GCC (GNU C Compiler) uses. The brains behind Arduinos are ATMega168s or ATMega328s. The AVR community typically uses “true c” commands to program these c

Phillip Torrone

Editor at large – Make magazine. Creative director – Adafruit Industries, contributing editor – Popular Science. Previously: Founded – Hack-a-Day, how-to editor – Engadget, Director of product development – Fallon Worldwide, Technology Director – Braincraft.


Related
blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,544 other followers