Advertisement
Guest User

Untitled

a guest
Aug 25th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. #include <Charliplexing.h>
  2. #include <Figure.h>
  3. #include <Font.h>
  4.  
  5.  
  6. void setup() {
  7.   Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
  8.   LedSign::Init(); //LolShield init
  9. }
  10. char scrollText[50] = {' '}; // Allocate some space for the string
  11. char inChar; // Where to store the character read
  12. int index = 0; // Index into array; where to store the character
  13. void loop() {
  14.  
  15.   while (Serial.available() > 0) {        // Check for incoming Serial Data
  16.      
  17.      
  18.       inChar = Serial.read(); // Read a character
  19.       scrollText[index] = inChar; //Add said char to string
  20.       index++;
  21.       }
  22.  
  23. //part below copypasted direct from LoLShield_FontTest and except with array name and for loop changed to fit the string I created.  I have a decent idea of what's going on but not really.
  24.  
  25.  
  26.   int8_t x=0,x2=0;
  27.   for(int8_t j=13;j>-100;j--) {
  28.     x=j;
  29.     LedSign::Clear();
  30.     for(int i=0;i<49;i++) {
  31.       x2=Font::Draw(scrollText[i],x,0);
  32.       x+=x2;
  33.       if (x>=13) break;
  34.     }  
  35.     delay(80);
  36.   }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement