Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/pgmspace.h>
- const int kPinLed = 6;//our output pin, i started with a tutorial on flashing an led, never got around to changing the name
- 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
- 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
- {
- //String OurLetter = String("");
- String OurLetter = String(TheBitsToBang);
- for(int i = 0; i < LetterArray; i++){
- //Serial.println(String(TheBitsToBang)[i]);//right now it's dumping the whole string
- //string.startsWith(string2)
- if(OurLetter.startsWith("0", i)){//66 seems to work
- delay(66);//HOW LONG TO _NOT_ PRINT EACH BIT FOR
- }
- else{
- tone(kPinLed, 2600, 66);//HOW LONG TO PRINT EACH BIT FOR 66 to 68 seems to work
- delay(66);//This is required or else it continues to the next bit without waiting the proper spacing
- }//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
- }//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
- delay(72);//BETWEEN LETTER SPACING
- }
- //THE SEVEN BY SEVEN FONT
- const char Ab[] PROGMEM = "0000000111110000111100011001001111011111000000000";
- const char Bb[] PROGMEM = "0000000011111101111110101001010100101010010110110";
- const char Cb[] PROGMEM = "0000000001110001111100110010011001000100100010010";
- const char Db[] PROGMEM = "0000000011111001000100100010010011000110000000000";
- const char Eb[] PROGMEM = "0000000011111001111100101010010101001000100100010";
- const char Fb[] PROGMEM = "0000000011111101111110001011000101100010110001001";
- const char Gb[] PROGMEM = "0000000011111001001100100010010101001110000000000";
- const char Hb[] PROGMEM = "0000000011111001111100001000011111001111100000000";
- const char Ib[] PROGMEM = "0000000010001001000100111110010001001000100100010";
- const char Jb[] PROGMEM = "0000000000101001100100100010011111000000100000010";
- const char Kb[] PROGMEM = "0000000011111001111100001000001010001000100000000";
- const char Lb[] PROGMEM = "0000000011111001111100110000011000001100000110000";
- const char Mb[] PROGMEM = "0000000011111000001000011000000010001111100000000";
- const char Nb[] PROGMEM = "0000000011111000001000001000001000001111100000000";
- const char Ob[] PROGMEM = "0000000001110001101100100010011011000111000000000";
- const char Pb[] PROGMEM = "0000000011111001111100001010000101000001100000000";
- const char Qb[] PROGMEM = "0000000011111001000100100010011001001111101000000";
- const char Rb[] PROGMEM = "0000000011111001111100001010001101001001101000000";
- const char Sb[] PROGMEM = "0000000010111001010100101010010101001110100000000";
- const char Tb[] PROGMEM = "0000000000011000001101111110000011000001100000000";
- const char Ub[] PROGMEM = "0000000011111001100000110000011000001111100000000";
- const char Vb[] PROGMEM = "0000000000011100010000010000000100000001110000000";
- const char Wb[] PROGMEM = "0000000011111001000000111110010000001111100000000";
- const char Xb[] PROGMEM = "0000000110001101101100001000011011011000110000000";
- const char Yb[] PROGMEM = "0000000000001000001001111000000010000000100000000";
- const char Zb[] PROGMEM = "0000000010001001100100101010010101001001100000000";
- const char ZEROb[] PROGMEM = "0000000011111001100100101010010011001111100000000";
- const char ONEb[] PROGMEM = "0000000000000001000100111110010000000000000000000";
- const char SPACEb[] PROGMEM = "0000000000000000000000000000000000000000000000000";
- const char HASHb[] PROGMEM = "0010100111111000101000010100111111000101000000000";
- const char PERIODb[] PROGMEM = "0000000000000000100000111000001000000000000000000";
- const char DASHb[] PROGMEM = "0000000001110000111000011100001110000111000000000";
- const char EXCLAMb[] PROGMEM = "0000000000000000000000101110010111000000000000000";
- const char SMILEb[] PROGMEM = "0000000001100001000110100000010001100110000000000";
- const char QUOTEb[] PROGMEM = "0000000000000000001100000000000011000000000000000";
- 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.
- 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.
- char buffer[50];//so the font is stuck in program storage space, and recovered when required
- //USED SO THE MESSAGE CAN BE TYPED IN AS AN ARRAY
- int A = 0;
- int B = 1;
- int C = 2;
- int D = 3;
- int E = 4;
- int F = 5;
- int G = 6;
- int H = 7;
- int I = 8;
- int J = 9;
- int K = 10;
- int L = 11;
- int M = 12;
- int N = 13;
- int O = 14;
- int P = 15;
- int Q = 16;
- int R = 17;
- int S = 18;
- int T = 19;
- int U = 20;
- int V = 21;
- int W = 22;
- int X = 23;
- int Y = 24;
- int Z = 25;
- int ZERO = 26;
- int ONE = 27;
- int SPACE = 28;
- int HASH = 29;
- int PERIOD = 30;
- int DASH = 31;
- int EXCLAM = 32;
- int SMILE = 33;
- int QUOTE = 34;
- int DIBLE = 35;
- /*
- * RUBARB BEACON - - "CONCEAL NOTHING. AND WATCH THE FOOLS SEARCH FOREVER." - PSALM OF KOSCS - VEDRAN ARCHIVES
- * - - SLOW FELD HELL BEACON RUNNING LESS THEN 100 MILLIWATTS - - SAY HI ON IRC.
- * SERVER: IRC.FREENODE.NET CHANNEL: #LAINCHAN.JP - - WISHING YOU ALL THE BEST! :)
- */
- //THIS LIST CONTAINS EACH VARIABLE, IN THIS VARIABLE IS THE INT, SO THE VALUE CAN BE RETRIEVED FROM PROGRAM MEMORY IN TO THE BUFFER
- //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
- // 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
- // WERENT BEING INCLUDED BECAUSE THE PROGRAM WASNT RUNNING RIGHT, SO I SWITCHED THEM TO STRINGS TO BE EASIER TO WORK WITH
- //ANYWAYS BELOW IS THE MESSAGE TO SEND
- 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};
- 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};
- 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};
- 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};
- const char messagefive[]={SPACE,T,H,E,SPACE,B,E,S,T,EXCLAM,SMILE};
- void sendMessage(){
- char i;
- for(i=0;i<sizeof(message);i++){//so it should go through the alphabit one letter at a time
- //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
- strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(message[i])]))); // Necessary casts and dereferencing, just copy.
- PrintLetter(buffer);
- //delay(3283);
- //Serial.println("GOT HERE");
- }
- }
- void sendMessageTwo(){
- char i;
- for(i=0;i<sizeof(messagetwo);i++){//so it should go through the alphabit one letter at a time
- //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
- strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagetwo[i])]))); // Necessary casts and dereferencing, just copy.
- PrintLetter(buffer);
- //delay(3283);
- //Serial.println("GOT HERE");
- }
- }
- void sendMessageThree(){
- char i;
- for(i=0;i<sizeof(messagethree);i++){//so it should go through the alphabit one letter at a time
- //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
- strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagethree[i])]))); // Necessary casts and dereferencing, just copy.
- PrintLetter(buffer);
- //delay(3283);
- //Serial.println("GOT HERE");
- }
- }
- void sendMessageFour(){
- char i;
- for(i=0;i<sizeof(messagethree);i++){//so it should go through the alphabit one letter at a time
- //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
- strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagefour[i])]))); // Necessary casts and dereferencing, just copy.
- PrintLetter(buffer);
- //delay(3283);
- //Serial.println("GOT HERE");
- }
- }
- void sendMessageFive(){
- char i;
- for(i=0;i<sizeof(messagefive);i++){//so it should go through the alphabit one letter at a time
- //to print the letter, it must be taken from program memory and placed in ram, then dumped in here:
- strcpy_P(buffer, (char*)pgm_read_word(&(string_table[(messagefive[i])]))); // Necessary casts and dereferencing, just copy.
- PrintLetter(buffer);
- //delay(3283);
- //Serial.println("GOT HERE");
- }
- }
- void setup() {
- pinMode(kPinLed, OUTPUT);
- //Serial.begin(9600);
- }
- 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
- 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
- sendMessageTwo();//to fix the real issue, i did this.
- sendMessageThree();
- sendMessageFour();
- sendMessageFive();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement