I want to consider a project where I make a simple snake-like game, to get some more experience.
I thougth that if I made a matrix, say a 5x5 matrix of zeros, I could make a snake like game if the snake was displayed by the number 1 in the matrix.
Should be possible. Even with much bigger matrices.
I would move the "snake" by joystick or buttons, which should be fine.
You could control either the Arduino directly by connecting something on the Arduino
- IR receiver
so the input is given directly to the Arduino, and Serial is only used for sending the output to the terminal screen.
Or you could control the Arduino with keyboard input over Serial and the Arduino sends back output to the terminal screen as well over Serial.
1) I am guessing the serial monitor is a poor choice for this?
You are right. Arduinos serial monitor is limited for keyboard input which always must be finished hitting the ENTER key. And Arduinos serial monitor is a 'dumb terminal'. But you would need something like a VT52, VT100 or ANSI terminal, so you will need to use a terminal program instead of the serial monitor to send nice terminal codes to the screen.
2) Could I rather use the terminal (linux) and refresh the matrix from my computer, and only use the arduino for controls?
I don't understand that question. The Arduino takes input from whereever (terminal or other) and sends output to the terminal to show what's going on.
3) Say I make a program in C, and I'm currently in the while(1) part of my program, and waiting for input on the arduino. The matrix is constantly being "refreshed". If I'm communicating with the arduino and using it for control inputs, how does this work in terms of data transfer? The arduino works at 16 Mhz, and my computer far more. Or is the baud rate what determines the speed (bottleneck)? This is maybe a basic hardware question, would love to understand how it works.
If your programming is done "the matrix constantly being refreshed", then the Serial baudrate will be the bottleneck. Max. Serial baudrate for Arduino is 500000 baud when communicating with a terminal over Serial-USB. But you need not "the matrix constantly being refreshed" for a snake-like game. For a snake-like game you need:
- clear the screen when the game begins
- send one char (and possibly one position) to the screen at each move of the snake
4) I haven't compiled any projects from the terminal before. Do you have any guides or help on how to get started with this? I'd rather use VIM or gedit than the IDE. Do you perhaps have a never makefile? I saw there were makefiles when I googled but they seem to be a bit dated.
REAL programmers use Emacs.
For what reason you want to use an Arduino?
If you just want to write a program that takes input from the keyboard and sends output to a terminal screen, you really need no Arduino. It can be done with a PC alone, without any Arduino for nothing.
The Arduino IDE is JAVA based and provides a complete and easy to use toolchain for editing, compiling, linking and uploading to the Arduino controller. You'd really need to have good internal knowledge about everything (compiler, linker, programmer) to set up your own toolchain not based on the Arduino IDE.