Close

void system(char* input){ ... }

A project log for Arduino Desktop

The desktop with an arduino as the main processor. Multitasking, Gaming, Graphics, and (later) File IO

Dylan BrophyDylan Brophy 08/01/2017 at 20:400 Comments

C++ has this function, system(), that executes a command.  If I want a command line for my arduino computer, I might as well implement this function.

My friend, @Andrey Skvortsov, sent me an arduino shield that makes the arduino a ton more powerful.  It adds 32KB of SRAM, but its parallel, not serial.  Furthermore it maps directly into the AVR address space, so you don't have to manipulate pins.  Its basically an extra 32KB blazing fast SRAM addition for the Arduino MEGA.  I have barely used it to any potential, but I have begun making memory allocation functions and such for it, so I can go farther.  My system function actually uses the shield, and removing the shield breaks the system() function.  SO the shield works!  See that project here: #Arduino MEGA 2560 32Kb RAM shield 

I had the arduino auto-execute these commands:

sudo
sudo -f
terminate 0
lsps

Output:


The sudo command is like linux : get elevated permissions.  I added sudo -f, f as in FORCE.  Basically force events to occur where possible.  So the "Self-hacking ENABLED" is from sudo -f.  terminate 0 : terminate process 0 (but there was no process, so we get error bad PID).  lsps is LiSt ProceSses.  It said "0 processes:", because no processes were executing.

Now I am working on a terminal and will add more commands later.  Terminal, for now, will block all other processes until exit.  Multitasking terminals, as I have discovered, aren't the easiest.

Discussions