artillect / serial-typewriter

This is the Arduino code for my typewriter computer project.
53 stars 1 forks source link

[Request] Provide Example Hardcoded ASCII Art Arduino Sketch #1

Open unixn3rd opened 2 years ago

unixn3rd commented 2 years ago

Hello Artillect!

You've inspired me to follow in your footsteps and build a Linux typewriter interface myself! I picked up a Brother AX-28 and some multiplexers yesterday! After a couple hours of work I've got everything except the Raspberry Pi components setup. However I would like to check my work before continuing further.

I attempted to issue input over the Arduino serial monitor but quickly realized that won't work as there is no serial communication yet. Can you provide a code sample to run a test print that is hardcoded on the Arduino?

Thanks for the inspiration!

artillect commented 2 years ago

Hey unixn3rd!

I'm glad you like my project, and decided to try out making your own!

If you break up a piece of ASCII art into lines, put each line in a typestring() with a \n at the end, and put that at the end of your setup, that should work! Here's a few examples, I'll add them to the repository when I get a chance:

void setup() {
...
// Put this after your setup

// From https://www.asciiart.eu/electronics/light-bulbs
typestring("     :\n");
typestring(" '.  _  .'\n");
typestring("-=  (-)  =- \n");
typestring(" .'  #  '.\n");

...

// From https://www.asciiart.eu/animals/cats
typestring("          .__....._             _.....__,\n");
typestring("            .": o :':         ;': o :".\n");
typestring("            '. '-' .'.       .'. '-' .'\n");
typestring("              '---'             '---'\n");
typestring("\n");
typestring("    _...----...      ...   ...      ...----..._\n");
typestring(" .-'__..-""'----    '.  '"'  .'    ----'""-..__'-.\n");
typestring("'.-'   _.--"""'       '-._.-'       '"""--._   '-.'\n");
typestring("'  .-"'                  :                  '"-.  '\n");
typestring("  '   '.              _.'"'._              .'   '\n");
typestring("        '.       ,.-'"       "'-.,       .'\n");
typestring("          '.                           .'\n");
typestring("            '-._                   _.-'\n");
typestring("                '"'--...___...--'"'\n");

...

typestring("          .::-==++++++++==--:.\n");
typestring("      .:=+++++++++++++++++++++*+-.\n");
typestring("    :==+++*********++++++++++++++**=\n");
typestring("  :===++**#########***+++++==+++++**#=\n");
typestring(" -===+++**#%##########**+++===++++**#%*\n");
typestring(":=====+++**####%#*++++**#*++++++++**#%@+\n");
typestring("=======+++++**-.         -++++++***##%%%\n");
typestring("========++++++++++====++++++++****##%%%%\n");
typestring("-+++++++++++++++++++++++++******##%%%%%+\n");
typestring(" =++++++++++++++++++++*******###%%%%%%#\n");
typestring("  =*++++++++++++*********####%%%%%%%%+\n");
typestring("   .+***************#####%%%%%%%%%%*:\n");
typestring("     .-*###########%%%%%%%%%%%%%#=.\n");
typestring("         :+*%@@@@%%%%%%%%%%%*+-.\n");

...

typestring("                                :=+++***+.\n");
typestring("                                 -+++***-\n");
typestring("                                  :+*##.\n");
typestring("                     .......::::-=====++=--::::::....\n");
typestring("                  -===============++++++++++********##*-               ::--=++=:\n");
typestring("           ......-===============+++++++++++*******####%-            -==+#%+:\n");
typestring("  :-=+********++================++++++++++++********####%:          ==+*%*.\n");
typestring(":+##*=-::......================++++++++++++*********####%%.        -==*%*\n");
typestring("+##*:         :===============+++++++++++++*********#####%#.      :==+##\n");
typestring("=*##=        .==============++++++++++++++*********#####%%%*     :==+*%:\n");
typestring(".****:       ===========+++++++++++++++++*********#####%%%%#=::-===+*%*\n");
typestring(" .****-     -======++++++++++++++++++++**********#####%%%%%%#%+===+*%%.\n");
typestring("   =#*++:   ===+++++++++++++++++++++***********######%%%@%%%%%%+*#%%%:\n");
typestring("     =**+=--+++++++++++++++++++++************######%%@@@@%%%%%@%%%%*.\n");
typestring("       :=**+++++++++++++++++*************#######%%%%@@@%%%%%%%%%#+:\n");
typestring("          .-***********************#######%%%%%@@@@%%%%%%%%%%+-.\n");
typestring("            :*################%%%%%%%%%%@@@@@%%%%%%%%%%%%%%%=\n");
typestring("              =%@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%%%*.\n");
typestring("                =#@@@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#=.\n");
typestring("                  -#@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#+.\n");
typestring("                     :-=+**##%%%%%%%%%%%%%%###*++=-:.\n");

}
unixn3rd commented 2 years ago

Hey Artillect.

Thank you for the speedy response!

I've been working on this more this morning and I am unable to get things to work so far. I'm getting strange and inconsistent results.

I was hoping you'd be able to shed some insight into whats wrong.

I am still just working on the Arduino side of things. No Raspberry Pi or serial communication circuit installed yet. Also for clarity's sake I am running the non-keyboard design for now. So in other words your initial configuration.

I have verified that my keyboard matrix mapping is the same as yours. At least as far as I can tell.

Here is what my printable characters for each pin row look like:

1 iyrwp 2 uteo307 3 jgds426+ 4 lfa½]'1 5 khq;+598 6 mbcz(\n)=. 7 nvx,/ 8 <nothing printable here except Space>

Sometimes I get random characters printing for seemingly no reason when I power on my Arduino and the characters are inconsistent between power cycles. So there's no obvious pattern. This happens even when I don't have any hardcoded typeString statements in my code.

When I do hardcode typeString statements I get the same sort of behavior. Random and inconsistent characters printing / key presses. I can hear beeps and the typewriter will cycle through different functions sometimes from different key functions firing I assume.

I suppose I should also mention that I did verify that the typewriter functioned correctly before starting. And that I have modified the PCB as you did in your latest video. I replaced the keyboard matrix connectors for female pin headers. I also tested the keyboard matrix mapping after this. So as far as I can tell everything is working as it should.

I've double/triple checked my wiring and as far as I can tell I have my wiring between the typewriter and multiplexers installed correctly. I've also experimented with this by flipping the order of pins just as a sanity check.

The other side of the multiplexers is a different story though.

I see that in the code you have pins defined as follows:

#define RX 2
#define TX 3
#define EN 4
#define S10 5
#define S11 6
#define S12 7
#define S13 12
#define S20 13
#define S21 10
#define S22 11

int colPins[] = {S10, S11, S12, S13};
int rowPins[] = {S20, S21, S22};

I'm trying to understand why you have S13 jump to pin 12 after using pins 5,6,7. Also why are S20 - S22 out of order. This is probably a lack of knowledge on my part.

Adding to the confusion with the pin out is the numbering you used in the circuit diagram. And on top of that it looks like the wiring you had in the photos on your youtube video is different too.

I'm just trying to gain some insight into what the problem might be and hoping that you might be able to help make sense of whats wrong here.

I look forward to your response.

Thanks!