Advertisement
Guest User

Untitled

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