Digistump Forums

The Digispark => Digispark Projects => Topic started by: dmcinnes on January 04, 2013, 07:06:00 pm

Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 04, 2013, 07:06:00 pm
Hey Folks,
I've been toying around with the Charlieplex kit and made some code to output scrolling text. Check it out:

https://github.com/dmcinnes/charlieplex-marquee

Anyone know a way I could also run the USB serial interface at the same time? I know the CharliePlex kit is already using the serial interface pins, but is it possible to disable DigiUSB when I'm showing text but enable it when it's done? It would be cool to have a miniature text display using this kit, maybe one that accepts output from OS X Notification Center or Growl.
Title: Charlieplex Kit Marquee Code
Post by: Bluebie on January 04, 2013, 09:52:19 pm
I don\'t think that could work - the USB pins are bidirectional, so they would make the LEDs flash and would probably interfere with the connection.
Title: Charlieplex Kit Marquee Code
Post by: digistump on January 04, 2013, 11:36:37 pm
That would be very tough to do - I\'d think you\'d need some sort of switch on the lines - like a transistor - that was controlled by P5 to cutoff the connection to the LEDs - which would mean no direct plug in of the shield...

I think the better solution would be a LED matrix with an I2C driver and then use code similar to the USB2LCD code in the newest release (going up any moment now)
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 05, 2013, 03:57:59 pm
I figured as much :) No harm in asking though!

I\'ve uploaded a video of the marquee in action:
http://www.youtube.com/watch?v=s9DNU_1o9C8

Title: Charlieplex Kit Marquee Code
Post by: digistump on January 05, 2013, 10:18:14 pm
@dcminnes - this is a really cool example - can I include it in the next release?
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 05, 2013, 11:12:25 pm
@digistump Thanks! Go for it :)
Title: Charlieplex Kit Marquee Code
Post by: plexer on January 06, 2013, 07:19:05 am
Looks great is it possible to slow down the scrolling at all?

Ben
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 06, 2013, 10:07:41 am
@plexer it moves every 100ms, just change this line to be a higher number:

https://github.com/dmcinnes/charlieplex-marquee/blob/master/charlieplex.ino#L106

I\'m going to pull out a few of these magic numbers as #defines to clear it up a bit
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 06, 2013, 10:28:21 am
@plexer OK cleaned up the code a bit, just change the SPEED constant -- it\'s in \"pixels\" per second:

https://github.com/dmcinnes/charlieplex-marquee/blob/master/charlieplex.ino#L8
Title: Charlieplex Kit Marquee Code
Post by: Bluebie on January 06, 2013, 06:28:48 pm
This is heaps cool!!!
Title: Charlieplex Kit Marquee Code
Post by: plexer on January 08, 2013, 11:50:24 am
@dmcinnes great just soldered up my charlieplex shield this evening and running your code on it good job.

I have to say with the shield though I think soldering the headers before the leds would be easier.

Ben
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 08, 2013, 11:05:46 pm
@plexer and @Bluebie thanks!

I had a hard time with the headers too. Maybe the 6 pin header first, then the leds then the 3 pin header so it\'s not too crowded.
Title: Charlieplex Kit Marquee Code
Post by: Bluebie on January 08, 2013, 11:45:59 pm
I think it\'d be a lot easier to assemble if first you trim the wires on all of the LEDs to be slightly longer than they need to be to go through the holes in the board, then solder them all at once. I had a lot of trouble getting the LEDs to lay flat against the board, and soldering and trimming each row of leads one by one was messy, slow, and not very fun.
Title: Charlieplex Kit Marquee Code
Post by: plexer on January 09, 2013, 02:40:04 am
I did them a row at a time and pushed them and the board in to some bluetack. It certainly helped mine all stay pushed against the board.

http://youtu.be/2SnG5nOkE_g

Thinking of putting some film in front of it to dull the display slightly as those litle leds are bright.

Ben
Title: Charlieplex Kit Marquee Code
Post by: shawn on January 11, 2013, 01:27:41 pm
Thanks for this code @dmcinnes, It\'s great! I just finished soldering up my charlieplex and now it\'s actually doing something fun and useful!

I agree it would be great to be able to control it via the usb connection. doesn\'t sound feasible though.
Title: Charlieplex Kit Marquee Code
Post by: sparr on January 11, 2013, 02:34:25 pm
Thanks! I haven\'t gotten to assemble my kits yet so I didn\'t get around to writing any code for this, but I\'m glad to see people successfully using it! I hope to have a pixel and bitmap library for it soon.
Title: Charlieplex Kit Marquee Code
Post by: ehisforadam on January 13, 2013, 09:12:08 am
Wow! This is really cool and helpful for someone like me who really doesn\'t know how to program. One issues I\'m having is Z doesn\'t seem to work right. It comes across all garbled up.
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 16, 2013, 10:35:47 am
Glad everyone digs it!

@ehisforadam I haven\'t tested this but I think the characterMap array might be one element too short so when rendering Z it\'s just reading from random memory. Try upping the size it to 59:

https://github.com/dmcinnes/charlieplex-marquee/blob/master/charlieplex.ino#L15

(Z in ASCII is 90, 90 - 32 = 58, which is just outside the range of the array)
Title: Charlieplex Kit Marquee Code
Post by: dmcinnes on January 17, 2013, 06:10:05 pm
@ehisforadam yep, that was it. I\'ve updated the code on GitHub
Title: Charlieplex Kit Marquee Code
Post by: ehisforadam on January 19, 2013, 09:02:57 am
@dncinnes awesome! It works perfectly. Thanks.
Title: Re: Charlieplex Kit Marquee Code
Post by: AlanSE on February 06, 2013, 06:28:23 am
Hi, thanks dmcinnes for your contribution!  I hope to try it out soon when I finish soldering my shield.

I'm confused about what it says on the wiki.

http://digistump.com/wiki/digispark/tutorials/led

Quote
Programming:   A basic demo sketch is included with the Digispark Arduino Addon package. We hope that Sparr or other members of the community will contribute a working library to make it easier to use.

Where?  I don't see any Charlieplex in the examples.  I can use the code linked to, but I think it would be nice if the wiki had some useful links for other newcomers to follow.  I just don't see where the standard example is supposed to be and I'm confused.
Title: Re: Charlieplex Kit Marquee Code
Post by: digistump on February 06, 2013, 10:53:07 am
You can find the included example: File->Examples->Digispark->Charlieplex


The wiki is open for all to edit and contribute - so if you feel it is missing something please feel free to add it!


Thanks,
Erik
Title: Re: Charlieplex Kit Marquee Code
Post by: digistump on March 20, 2013, 06:59:38 pm
This is now included in the official release. http://digistump.com/wiki/digispark/tutorials/connecting#software
Title: Re: Charlieplex Kit Marquee Code
Post by: dmcinnes on March 20, 2013, 08:43:24 pm
Cool!