Comments on: Arduino, Circular Linked Lists, and Christmas Lights http://www.gnewt.at/blog/2012/06/christmas-lights-linked-lists/ She turned me into a Gnewt! I got better... Mon, 10 Nov 2014 05:15:14 +0000 hourly 1 https://wordpress.org/?v=4.7.2 By: Arduino Lover http://www.gnewt.at/blog/2012/06/christmas-lights-linked-lists/comment-page-1/#comment-10608 Sun, 01 Jul 2012 18:02:43 +0000 http://www.gnewt.at/blog/?p=192#comment-10608 >> curr = head = (rgb*)malloc(sizeof(rgb));
You’d better check the return from malloc for NULL.
You can easily run out of heap space on the arduino

]]>
By: Gnewt http://www.gnewt.at/blog/2012/06/christmas-lights-linked-lists/comment-page-1/#comment-10469 Thu, 28 Jun 2012 05:14:41 +0000 http://www.gnewt.at/blog/?p=192#comment-10469 Thanks! I had been thinking about linked lists earlier and hadn’t played with them before… so when all you have is a hammer, everything looks like a nail. The circular buffer seems like a much more elegant solution.

]]>
By: asokoloski http://www.gnewt.at/blog/2012/06/christmas-lights-linked-lists/comment-page-1/#comment-10449 Wed, 27 Jun 2012 20:38:02 +0000 http://www.gnewt.at/blog/?p=192#comment-10449 Hi, you may want to take a look at a datastructure called a “circular buffer”. It seems like it would be a very good fit for your problem, and avoid the extra memory overhead of a linked list.

http://en.wikipedia.org/wiki/Circular_buffer

]]>