/*
Welcome to ArduinoOS v1.0 Serial Editon by @bockring.
This is a operating system for Arduino devices.
Please use Arduino Mega 2560 or Arduino Due.
If you use this software, please read all the "README.docx".
You will needs:
Arduino Mega 2560 or Arduino Due x1
USB connector(USB Host) x1
USB to Serial transfer PCB x1
D.C. jack(5.5mm φ2.1mm) x1
A.C. adaptor(Recomend:12V 1.5A) x1
Box(can include device) x1
Some wires
Arduino IDE installed PC x1(This software need to connect PC)
USB cabel x1
Command reference
shutdown //Turn off your computer
*/
char input = ""; //Input and save letters
char output = ""; //Output letters
char command = ""; //Entered command
long cache1 = "";
long cache2 = "";
long cache3 = "";
int login = 0;
char username[16] = "Admin"; //Set your user name here(Up to 16 letters)
char password[32] = "Password"; //Set your password here(Up to 32 letters)
void setup() {
Serial.begin(9600);
String password = String(password);
digitalWrite(13, HIGH);
Serial.println(" ■■■■■ ■■■■■"); //Print Arduino logo
Serial.println(" ■ ■ ■ ■");
Serial.println(" ■ ■ ■ ■ ■");
Serial.println("■ ■ ■ ■ ■");
Serial.println("■ ■■■■■■■■■■■ ■ ■■■■■■■■■■■ ■");
Serial.println("■ ■ ■ ■ ■");
Serial.println(" ■ ■ ■ ■ ■");
Serial.println(" ■ ■ ■ ■");
Serial.println(" ■■■■■ ■■■■■");
Serial.println("Now loading the system files...");
delay(3000);
Serial.println(" ");
Serial.println("Welcome to ArduinoOS v1.0 Serial Edition!");
Serial.println(" ■ ■");
Serial.println(" ■ ■ ■ ■ ■■■■ ■■■■");
Serial.println(" ■ ■ ■ ■ ■ ■");
Serial.println("■ ■ ■ ■■■ ■■■■ ■ ■ ■ ■ ■■ ■■■ ■ ■ ■");
Serial.println("■ ■ ■■ ■ ■ ■ ■ ■ ■■ ■ ■ ■ ■ ■ ■■■");
Serial.println("■■■■■■■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■");
Serial.println("■ ■ ■ ■ ■ ■ ■■ ■ ■ ■ ■ ■ ■ ■ ■");
Serial.println("■ ■ ■ ■■■■ ■■ ■ ■ ■ ■ ■■■ ■■■■ ■■■");
Serial.println("");
delay(500);
}
void loop() {
//Login process
if (login == 0) {
Serial.println("Please enter the password.");
Serial.print("USERNAME : ");
Serial.println(username);
Serial.println("PASSWORD : ");
login = 1;
}
if (Serial.available()) {
String input = String(Serial.readStringUntil(0x0a));
if (input == password) {
Serial.println("Succeed. Now loging in...");
login = 2;
goto mainprocess;
} else {
login = 0;
}
if (input != password & input != ""& login == 0) {
Serial.println("Failed. Please Try again.");
Serial.println("");
Serial.println("PASSWORD : ");
input = "";
login = 0;
}
if (input == ""& login != 2) {
login = 1;
delayMicroseconds(1);
}
mainprocess: //Main process
if (login == 2) { //Login checker
Serial.println("");
Serial.println("Welcome to ArduinoOS v1 Serial Edition.");
Serial.println("This software was made by @bockring.");
for (login = 2; login == 2; login = login + 0) {
Serial.print(username);
Serial.print("@ArduinoOS:~$ ");
if (Serial.available()) {
String command = String(Serial.readStringUntil(0x0a));
Serial.println(command);
//If you want to add commands, please write commands, and features here.
if (command == "shutdown") {
Serial.println("Are you sure to turn off this computer?(y/n)");
shutdown:
input = Serial.readStringUntil(0x0a);
if (input == "y") {
Serial.println("Shuting down now...");
delay(1000);
Serial.println("If you want to reboot, please press reset buttom.");
Serial.println("Disconnected");
Serial.end();
goto off;
} else if (input != "n") {
goto shutdown;
}
}
}
}
off:
for (cache1 = 0; cache1 == 0; cache1 = cache1 + 0) {
delay(1000);
}
}
}
}