#!/bin/bash Mode=USB # (UART / USB ) Output=0 Beep=0 # echo "T" >/dev/ttyAMA0 echo -n "Serial ledStatus v1.0 : " if [ $Mode = "UART" ] then echo -e "UART mode\n" Output=ttyAMA0 else echo -e "USB mode\n" Output=ttyACM0 fi stty -F /dev/ttyACM0 ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo ip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') test=$(mcstatus $ip status | grep players: | awk '{print$2}' | sed 's/\x2F20//g') player1=$(mcstatus $ip status | grep players: | awk '{print$3}' | sed 's/\[\x2E//g') date_raw=$(date +%H%M) case $Beep in 0*) echo "Buzzer:OFF" echo "z" >/dev/$Output sleep 1 ;; 1*) echo "Buzzer:ON" echo "Z" >/dev/$Output sleep 1 ;; *) ;; esac case $date_raw in [0700-2200]*) echo "Day:ON" echo "D" >/dev/$Output sleep 1 ;; [2201-0659]*) echo "Day:OFF" echo "N" >/dev/$Output sleep 1 ;; *) ;; esac case $test in 0*) echo "O" echo "0" >/dev/$Output ;; 1*) if [ $player1 = "Tristus51" ] then echo "Code:Tristan only" echo "T" >/dev/$Output echo $tristan elif [ $player1 = "MisterPig51" ] then echo "Code:MisterPig only" echo "V" >/dev/$Output elif [ $player1 = "BobBadin" ] then echo "Code: Ethan Only" echo "E" >/dev/$Output else echo "1" >/dev/$Output fi ;; 2*) echo "Code: two" echo "2" >/dev/$Output ;; [3-9]|[1-2][0-0]*) echo "Code: further" echo "3" >/dev/$Output ;; *) echo $test echo "Code: Error" echo "X" >/dev/$Output ;; esac