Hi,
I've got a NYSE LED ticker that I finally figured out how to write characters to. It uses a 6-bit character code at 134.5 bits per second. I haven't figured out how to make Serial write to it, but I can bit-bang it.
I need help understanding how to convert ASCII characters to the character codes. Do I need a lookup table or what, and what should that look like.
Here is the table for the characters:
0x00 Undef
0x10 T
0x20 Figure D
0x30 1/8
0x01 E
0x11 Z
0x21 5
0x31 7/8
0x02 Letter Dot
0x12 L
0x22 C
0x32 S/S
0x03 A
0x13 W
0x23 1
0x33 1/2
0x04 Pr
0x14 H
0x24 Figure Dot
0x34 8
0x05 S
0x15 Y
0x25 S
0x35 3/4
0x06 I
0x16 P
0x26 9
0x36 S/T
0x07 U
0x17 Q
0x27 Spare 1/
0x37 1/4
0x08 WI
0x18 O
0x28 0
0x38 Spare Figure Dot
0x09 D
0x19 B
0x29 4
0x39 2
0x0A R
0x1A G
0x2A End Announcement Char
0x3A7
0x0B J
0x1B &
0x2B Begin Announcement Char
0x3BB
0x0C N
0x1C M
0x2C Space
0x3C $
0x0D F
0x1D X
0x2D 6
0x3D 5/8
0x0E C
0x1E V
0x2E 3
0x3E 3/8
0x0F K
0x1F R/T
0x2F Spare Figure Dot
0x3F Undef
And here is what my sketch for HELLO WORLD looks like:
int interval = 7;
int charDelay = 1;
char myText[]={0x14, 0x01, 0x12, 0x12, 0x18, 0x2C, 0x13, 0x18, 0x0A, 0x12, 0x09, 0x2C};
void setup() {
pinMode(1, OUTPUT);
}
void loop(){
for (int i = 0; i < 12; i ++){
displayChar(myText[i]);
}
}
void displayChar(byte charToDisplay){
startBit();
for (byte i = 0; i < 6; i ++){
byte myBit = bitRead(charToDisplay, i); // the letter C 0r 001110
digitalWrite(1, myBit);
delay(interval);
}
stopBit();
}
void stopBit(){ // two intervals of stop bit
digitalWrite(1, LOW);
delay(interval);
delay(interval);
digitalWrite(1, HIGH);
}
void startBit(){ // one interval for start bit
digitalWrite(1, LOW);
delay(interval);
digitalWrite(1, HIGH);
}
I plan to use a computer to send serial data to the ticker over an HC-05 bluetooth serial module from maybe a Raspberry Pi or other computer. Maybe I should do the data conversion on the sending side? Any pointers for doing that in Python also appreciated.
Thanks,
Jimmy