Advertisement
Guest User

HELLSCHRIEBER SLOW FELD HELL BEACON

a guest
Jun 28th, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.88 KB | None | 0 0
  1. #include <avr/pgmspace.h>
  2.  
  3. const int kPinLed = 6;//our output pin, i started with a tutorial on flashing an led, never got around to changing the name
  4. const int LetterArray = 49;//7*7 there's 49 bits in the array, this might just be some leftover scrap of code, a figment doing nothin
  5.  
  6.  
  7. void PrintLetter(char TheBitsToBang[50])//for some reason this is 50, i have long since forgotten why this is importent, i remember 49 throwing some wierd outputs
  8. {
  9.    //String OurLetter = String("");
  10.    String OurLetter = String(TheBitsToBang);
  11.   for(int i = 0; i < LetterArray; i++){
  12.     //Serial.println(String(TheBitsToBang)[i]);//right now it's dumping the whole string
  13.     //string.startsWith(string2)
  14.     if(OurLetter.startsWith("0", i)){//66 seems to work
  15.       delay(66);//HOW LONG TO _NOT_ PRINT EACH BIT FOR
  16.     }
  17.     else{
  18.       tone(kPinLed, 2600, 66);//HOW LONG TO PRINT EACH BIT FOR 66 to 68 seems to work
  19.       delay(66);//This is required or else it continues to the next bit without waiting the proper spacing
  20.     }//WITH THE ABOVE DELAY SET TO THE TIME ON, IT PLACES A LITTLE TOO MUCH SPACE, WITH IT SET ONE UNDER, THE CHARACTERS HAVE JITTER
  21.   }//I suppose the proper way to fix the jitter/ delay would be to double the resolution of the characters to 14 by 14 and double the clock speed and double the timings
  22.   delay(72);//BETWEEN LETTER SPACING
  23. }
  24. //THE SEVEN BY SEVEN FONT
  25. const char Ab[] PROGMEM = "0000000111110000111100011001001111011111000000000";
  26. const char Bb[] PROGMEM = "0000000011111101111110101001010100101010010110110";
  27. const char Cb[] PROGMEM = "0000000001110001111100110010011001000100100010010";                      
  28. const char Db[] PROGMEM = "0000000011111001000100100010010011000110000000000";              
  29. const char Eb[] PROGMEM = "0000000011111001111100101010010101001000100100010";
  30. const char Fb[] PROGMEM = "0000000011111101111110001011000101100010110001001";
  31. const char Gb[] PROGMEM = "0000000011111001001100100010010101001110000000000";
  32. const char Hb[] PROGMEM = "0000000011111001111100001000011111001111100000000";
  33. const char Ib[] PROGMEM = "0000000010001001000100111110010001001000100100010";
  34. const char Jb[] PROGMEM = "0000000000101001100100100010011111000000100000010";
  35. const char Kb[] PROGMEM = "0000000011111001111100001000001010001000100000000";
  36. const char Lb[] PROGMEM = "0000000011111001111100110000011000001100000110000";
  37. const char Mb[] PROGMEM = "0000000011111000001000011000000010001111100000000";
  38. const char Nb[] PROGMEM = "0000000011111000001000001000001000001111100000000";
  39. const char Ob[] PROGMEM = "0000000001110001101100100010011011000111000000000";
  40. const char Pb[] PROGMEM = "0000000011111001111100001010000101000001100000000";
  41. const char Qb[] PROGMEM = "0000000011111001000100100010011001001111101000000";
  42. const char Rb[] PROGMEM = "0000000011111001111100001010001101001001101000000";
  43. const char Sb[] PROGMEM = "0000000010111001010100101010010101001110100000000";
  44. const char Tb[] PROGMEM = "0000000000011000001101111110000011000001100000000";
  45. const char Ub[] PROGMEM = "0000000011111001100000110000011000001111100000000";
  46. const char Vb[] PROGMEM = "0000000000011100010000010000000100000001110000000";
  47. const char Wb[] PROGMEM = "0000000011111001000000111110010000001111100000000";
  48. const char Xb[] PROGMEM = "0000000110001101101100001000011011011000110000000";
  49. const char Yb[] PROGMEM = "0000000000001000001001111000000010000000100000000";
  50. const char Zb[] PROGMEM = "0000000010001001100100101010010101001001100000000";
  51. const char ZEROb[] PROGMEM = "0000000011111001100100101010010011001111100000000";
  52. const char ONEb[] PROGMEM = "0000000000000001000100111110010000000000000000000";
  53. const char SPACEb[] PROGMEM = "0000000000000000000000000000000000000000000000000";
  54. const char HASHb[] PROGMEM = "0010100111111000101000010100111111000101000000000";
  55. const char PERIODb[] PROGMEM = "0000000000000000100000111000001000000000000000000";
  56. const char DASHb[] PROGMEM = "0000000001110000111000011100001110000111000000000";
  57. const char EXCLAMb[] PROGMEM = "0000000000000000000000101110010111000000000000000";
  58. const char SMILEb[] PROGMEM = "0000000001100001000110100000010001100110000000000";
  59. const char QUOTEb[] PROGMEM = "0000000000000000001100000000000011000000000000000";
  60. const char DIBLEb[] PROGMEM = "0000000000000001101100110110000000000000000000000";//You know a dible? its the : mark. Colon..... it took me the past 4 hours to realise its a colon.
  61.  
  62.  
  63. const char* const string_table[] PROGMEM = {Ab,Bb,Cb,Db,Eb,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb,ZEROb, ONEb, SPACEb, HASHb, PERIODb, DASHb, EXCLAMb, SMILEb, QUOTEb, DIBLEb};// Table to refer to strings.
  64. char buffer[50];//so the font is stuck in program storage space, and recovered when required
  65.  
  66. //USED SO THE MESSAGE CAN BE TYPED IN AS AN ARRAY
  67. int A = 0;
  68. int B = 1;
  69. int C = 2;
  70. int D = 3;
  71. int E = 4;
  72. int F = 5;
  73. int G = 6;
  74. int H = 7;
  75. int I = 8;
  76. int J = 9;
  77. int K = 10;
  78. int L = 11;
  79. int M = 12;
  80. int N = 13;
  81. int O = 14;
  82. int P = 15;
  83. int Q = 16;
  84. int R = 17;
  85. int S = 18;
  86. int T = 19;
  87. int U = 20;
  88. int V = 21;
  89. int W = 22;
  90. int X = 23;
  91. int Y = 24;
  92. int Z = 25;
  93. int ZERO = 26;
  94. int ONE = 27;
  95. int SPACE = 28;
  96. int HASH = 29;
  97. int PERIOD = 30;
  98. int DASH = 31;
  99. int EXCLAM = 32;
  100. int SMILE = 33;
  101. int QUOTE = 34;
  102. int DIBLE = 35;
  103.  
  104. /*
  105.  *  RUBARB BEACON - - "CONCEAL NOTHING. AND WATCH THE FOOLS SEARCH FOREVER." - PSALM OF KOSCS - VEDRAN ARCHIVES
  106.  *  - - SLOW FELD HELL BEACON RUNNING LESS THEN 100 MILLIWATTS - - SAY HI ON IRC.    
  107.  *  SERVER: IRC.FREENODE.NET      CHANNEL: #LAINCHAN.JP - - WISHING YOU ALL THE BEST! :)
  108.  */
  109.  
  110.  
  111. //THIS LIST CONTAINS EACH VARIABLE, IN THIS VARIABLE IS THE INT, SO THE VALUE CAN BE RETRIEVED FROM PROGRAM MEMORY IN TO THE BUFFER
  112. //WHY DID I USE PROGRAM MEMORY AND PULL IT OUT IN TO A BUFFER?  WHEN I FIRST WROTE THIS PROGRAM I DREW THE FONTS AS BINARY ARRAYS
  113. // THIS TOOK UP 133% OF THE AVAILABLE MEMORY. SO I TRIED STORING THEM IN MEMORY, THE COMPILER DIDNT THROW AN ERROR, BUT THEY ARRAYS PROBABLY
  114. // WERENT BEING INCLUDED BECAUSE THE PROGRAM WASNT RUNNING RIGHT, SO I SWITCHED THEM TO STRINGS TO BE EASIER TO WORK WITH
  115. //ANYWAYS BELOW IS THE MESSAGE TO SEND
  116. const char message[]={R,U,B,A,R,B,SPACE,B,E,A,C,O,N,SPACE,DASH,SPACE,DASH,SPACE,QUOTE,C,O,N,C,E,A,L,SPACE,N,O,T,H,I,N,G,PERIOD,SPACE,A,N,D,SPACE,W,A,T,C,H,SPACE,T,H,E,SPACE,F,O,O,L,S,SPACE,S,E,A,R,C,H,SPACE,F,O,R,E,V,E,R,PERIOD,QUOTE,SPACE,DASH,SPACE,P,S,A,L,M,SPACE,O,F,SPACE,K,O,S,C,S,SPACE,DASH,SPACE,V,E,D,R,A,N,SPACE,A,R,C,H,I,V,E,S,SPACE,DASH,SPACE,DASH,SPACE,S,L,O,W};
  117. const char messagetwo[]={SPACE,F,E,L,D,SPACE,H,E,L,L,SPACE,B,E,A,C,O,N,SPACE,R,U,N,N,I,N,G,SPACE,L,E,S,S,SPACE,T,H,E,N,SPACE,ONE,ZERO,ZERO,SPACE};
  118. const char messagethree[]={M,I,L,L,I,W,A,T,T,S,SPACE,DASH,SPACE,DASH,SPACE,S,A,Y,SPACE,H,I,SPACE,O,N,SPACE,I,R,C,PERIOD,SPACE,SPACE,SPACE,SPACE,S,E,R,V,E,R,DIBLE,SPACE,I,R,C,PERIOD,F,R,E,E,N,O,D,E,PERIOD};
  119. const char messagefour[]={N,E,T,SPACE,SPACE,SPACE,SPACE,SPACE,SPACE,C,H,A,N,N,E,L,DIBLE,SPACE,HASH,L,A,I,N,C,H,A,N,PERIOD,J,P,SPACE,DASH,SPACE,DASH,SPACE,W,I,S,H,I,N,G,SPACE,Y,O,U,SPACE,A,L,L};
  120. const char messagefive[]={SPACE,T,H,E,SPACE,B,E,S,T,EXCLAM,SMILE};
  121.  
  122.  
  123. void sendMessage(){
  124.   char i;
  125.   for(i=0;i<sizeof(message);i++){//so it should go through the alphabit one letter at a time
  126.     //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
  127.     strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(message[i])]))); // Necessary casts and dereferencing, just copy.
  128.     PrintLetter(buffer);
  129.     //delay(3283);
  130.     //Serial.println("GOT HERE");
  131.   }
  132. }
  133.  
  134. void sendMessageTwo(){
  135.   char i;
  136.   for(i=0;i<sizeof(messagetwo);i++){//so it should go through the alphabit one letter at a time
  137.     //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
  138.     strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagetwo[i])]))); // Necessary casts and dereferencing, just copy.
  139.     PrintLetter(buffer);
  140.     //delay(3283);
  141.     //Serial.println("GOT HERE");
  142.   }
  143. }
  144.  
  145. void sendMessageThree(){
  146.   char i;
  147.   for(i=0;i<sizeof(messagethree);i++){//so it should go through the alphabit one letter at a time
  148.     //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
  149.     strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagethree[i])]))); // Necessary casts and dereferencing, just copy.
  150.     PrintLetter(buffer);
  151.     //delay(3283);
  152.     //Serial.println("GOT HERE");
  153.   }
  154. }
  155.    
  156. void sendMessageFour(){
  157.   char i;
  158.   for(i=0;i<sizeof(messagethree);i++){//so it should go through the alphabit one letter at a time
  159.     //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
  160.     strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagefour[i])]))); // Necessary casts and dereferencing, just copy.
  161.     PrintLetter(buffer);
  162.     //delay(3283);
  163.     //Serial.println("GOT HERE");
  164.   }
  165. }
  166.  
  167. void sendMessageFive(){
  168.   char i;
  169.   for(i=0;i<sizeof(messagefive);i++){//so it should go through the alphabit one letter at a time
  170.     //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
  171.     strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagefive[i])]))); // Necessary casts and dereferencing, just copy.
  172.     PrintLetter(buffer);
  173.     //delay(3283);
  174.     //Serial.println("GOT HERE");
  175.   }
  176. }
  177.  
  178.  
  179.  
  180.  
  181.  
  182. void setup() {
  183.   pinMode(kPinLed, OUTPUT);
  184.   //Serial.begin(9600);
  185. }
  186.  
  187. void loop() {//I broke it up because I was getting some wierd problems withoutput. As an example, there were letters cut out or added in!!! Arrays not pointing where they are supposed to. The proper way to fix this would be to go
  188.   sendMessage();// and check each line. But when it takes 20 minutes to see a full output cycle.... it's too tedious. This is a disguisting hack. Instead of learning how
  189.   sendMessageTwo();//to fix the real issue, i did this.
  190.   sendMessageThree();
  191.   sendMessageFour();
  192.   sendMessageFive();
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement