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
ADVERTISEMENT