After initial problems with the Arduino Ide not synching correctly with my laptop we managed to get the laptop to see the Arduino on the correct COM port. We hope to get Arduino IDE across all the computers in Technology eventually.
We got started setting it up. It came with an instruction sheet which was very helpful in getting it up and running.
Connecting the board with an Arduino Uno proved to be pretty easy. Just connect the supplied ribbon cable the correct way around an its all linked up. Power is taken from the Arduino board itself, so convenient but can also be made brighter with the addition of an external power supply at 5V.
Getting the libraries into the Arduino IDE was pretty easy too.
A guide is available for you to see...
http://cdn.shopify.com/s/files/1/0045/8932/files/DMD_Getting_Started.pdf?100647
Once the libraries were installed into the correct place, we fired up a couple of example files to see what we would be able to do.
Scrolling text to announce sports results was what we really wanted, so we looked at thje code and made a few modifications...
To do so, have your sketch first assemble the text to display into a String variable. The maximum length is 255 characters. Or you can just have a fixed value, for example:
String textToScroll = "Hello, this is a really long length of text";You will also need the following function in your sketch:
void drawText(String dispString) { dmd.clearScreen( true ); dmd.selectFont( Arial_Black_16 ); char newString[256]; int sLength = dispString.length(); dispString.toCharArray( newString, sLength+1 ); dmd.drawMarquee(newString,sLength,( 32*DISPLAYS_ACROSS )-1 , 0 ); long start=millis(); long timer=start; long timer2=start; boolean ret=false; while(!ret){ if ( ( timer+20 ) < millis() ) { ret=dmd.stepMarquee( -1 , 0 ); timer=millis(); } } }Then to scroll the text, simply call the function as required, for example:
drawText(textToScroll);The following is the total sketch for a basic text-scrolling application using the function from above:
#include "SPI.h" #include "DMD.h" #include "TimerOne.h" #include "Arial_black_16.h" /* you can remove the fonts if unused */ #define DISPLAYS_ACROSS 1 #define DISPLAYS_DOWN 1 DMD dmd( DISPLAYS_ACROSS , DISPLAYS_DOWN ); void ScanDMD() { dmd.scanDisplayBySPI(); } void setup() { Timer1.initialize( 5000 ); Timer1.attachInterrupt( ScanDMD ); dmd.clearScreen( true ); } String textToScroll="Hello, this will be displayed on the DMD"; void drawText( String dispString ) { dmd.clearScreen( true ); dmd.selectFont( Arial_Black_16 ); char newString[256]; int sLength = dispString.length(); dispString.toCharArray( newString, sLength+1 ); dmd.drawMarquee( newString , sLength , ( 32*DISPLAYS_ACROSS )-1 ,0); long start=millis(); long timer=start; long timer2=start; boolean ret=false; while( !ret ){ if ( ( timer+20 ) < millis() ) { ret=dmd.stepMarquee( -1 , 0 ); timer=millis(); } } } void loop() { drawText(textToScroll); }
Arduino Libraries are kept on github here...
https://github.com/freetronics/DMD
Brodie managed to get the text to scroll across the screen and also managed to change the speed which is cool. We are still not certain that the average user would be able to get text onto this easily, as it requires code-level operation. The best scenario would be to be able to send text to the internet somehow, then for the 'net connected board to simply display it.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.