Your Name 4 years ago
parent
commit
cfef5ac30e

+ 9 - 1
README.md

@@ -1 +1,9 @@
-update file from working repo !
+Led color minecraft drive by mcstatus.
+
+for mcstatus install :
+sudo apt-get update
+sudo apt-get install python3-pip
+sudo python3 -m pip install mcstatus
+
+serial_led_minecraft.ino => arduino script
+

+ 0 - 0
color_ciode.ino → color_code.ino


+ 0 - 49
scripts/mcbackup.sh

@@ -1,49 +0,0 @@
-#!/bin/sh
-####################################
-#
-# Backup minecraft world to a
-# specified folder.
-#
-####################################
-
-day_raw=$(date +%A)
-case $day_raw in
-Sunday)
-day="Dimanche";;
-Monday)
-day="Lundi";;
-Tuesday)
-day="Mardi";;
-Wednesday)
-day="Mercredi";;
-Thursday)
-day="Jeudi";;
-Friday)
-day="Vendredi";;
-Saturday)
-day="Samedi";;
-*)
-;;
-esac
-archive_file="$day-Minecraft"
-
-echo $archive_file.tar.gz
-cd /tmp
-tar -I pigz -cvf /tmp/$archive_file.tar.gz  /home/dexter/minecraft/
-md5sum $archive_file.tar.gz > $archive_file.md5
-
-sudo mount -t cifs //mafreebox.freebox.fr/Disque\ dur/  /media/nas/ -o user=freebox,password=password,uid=1000,gid=1000,rw,vers=1.0
-sudo cp /tmp/$archive_file.tar.gz /media/nas/mc_backup
-sudo cp /tmp/$archive_file.md5 /media/nas/mc_backup
-sleep 6
-sudo umount /media/nas
-
-ncftpput -R -v -u "wareck" -p "zorn69" ftpperso.free.fr minecraft_bkp/ /tmp/$archive_file.tar.gz
-sleep 5
-ncftpput -R -v -u "wareck" -p "zorn69" ftpperso.free.fr minecraft_bkp/ /tmp/$archive_file.md5
-sleep 5
-
-sudo rm /tmp/$archive_file.tar.gz
-sudo rm /tmp/$archive_file.md5
-
-echo `date` "Backup done" >>/var/log/mc_backup/log

+ 6 - 0
scripts/mcled_status/bootdelay

@@ -0,0 +1,6 @@
+#!/bin/bash
+Raw_date="`date +%H%M`"
+cat <<'EOF'>> /tmp/bootdelay
+XXXX
+EOF
+sed -i -e "s/XXXX/$Raw_date/g" /tmp/bootdelay

+ 75 - 29
scripts/mcled_status/mcled_status

@@ -1,61 +1,107 @@
 #!/bin/bash
 #!/bin/bash
+Mode=UART # (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=serial
+#stty -F /dev/serial0 ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo
+echo "serial0" >/tmp/mcled
+else
+echo -e "USB mode\n"
+Output=ttyACM0
 stty -F /dev/ttyACM0 ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo
 stty -F /dev/ttyACM0 ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo
+echo "ttyACM0" >/tmp/mcled
+fi
+
 
 
-ip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
+#ip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
+#ip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
+ip=192.168.1.8
 test=$(mcstatus $ip status | grep players: |  awk '{print$2}' |  sed 's/\x2F20//g')
 test=$(mcstatus $ip status | grep players: |  awk '{print$2}' |  sed 's/\x2F20//g')
-player1=$(mcstatus 192.168.1.8 status | grep players: | awk '{print$3}' | sed 's/\[\x2E//g')
+player1=$(mcstatus $ip status | grep players: | awk '{print$3}' | sed 's/\[\x2E//g')
 date_raw=$(date +%H%M)
 date_raw=$(date +%H%M)
-cd ~/scripts/mcled_status/
 
 
-case $date_raw in
-[0700-2200]*)
-echo "Day mode"
-echo "D" >/dev/ttyACM0
-sleep 1
+if [ -f /tmp/bootdelay ]
+then
+boottime=`cat /tmp/bootdelay | awk '{print $1}'`
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "z" >/dev/$Output'
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "0" >/dev/$Output'
+echo
+echo "boot delay wait"
+sleep 600
+rm /tmp/bootdelay
+fi
+
+case $Beep in
+0*)
+echo "Buzzer: OFF"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "z" >/dev/$Output'
 ;;
 ;;
-[2201-0659]*)
-echo "Night mode"
-echo "N" >/dev/ttyACM0
-sleep 1
+1*)
+echo "Buzzer: ON"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "Z" >/dev/$Output'
 ;;
 ;;
 *)
 *)
 ;;
 ;;
 esac
 esac
 
 
+if [ "$date_raw" -ge 0900 -a "$date_raw" -le 2100 ]
+then
+echo "Day: ON"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "D" >/dev/$Output'
+else
+echo "Day: OFF"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "N" >/dev/$Output'
+fi
+
+
 case $test in
 case $test in
 0*)
 0*)
-echo "O"
-echo "0" >/dev/ttyACM0
+echo "Players: O"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "0" >/dev/$Output'
+#curl http://192.168.1.120/off
 ;;
 ;;
 1*)
 1*)
 if [ $player1 = "Tristus51" ]
 if [ $player1 = "Tristus51" ]
 then
 then
-echo "tristan only"
-echo "T" >/dev/ttyACM0
+echo "Code: Tristan"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "T" >/dev/$Output'
+#curl http://192.168.1.120/on
 echo $tristan
 echo $tristan
-elif [ $player1 = "MisterPig51" ]
+elif [ $player1 = "ALVARE" ]
 then
 then
-echo "MisterPig only"
-echo "V" >/dev/ttyACM0
+echo "Code: MisterPig"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "V" >/dev/$Output'
+#curl http://192.168.1.120/on
 elif [ $player1 = "BobBadin" ]
 elif [ $player1 = "BobBadin" ]
 then
 then
-echo "Ethan Only"
-echo "E" >/dev/ttyACM0
+echo "Code: Ethan"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "E" >/dev/$Output'
+#curl http://192.168.1.120/on
 else
 else
-echo "1" >/dev/ttyACM0
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "1" >/dev/$Output'
+#curl http://192.168.1.120/on
 fi
 fi
 ;;
 ;;
 2*)
 2*)
-echo "two"
-echo "2" >/dev/ttyACM0
+echo "Code: two"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "2" >/dev/$Output'
+#curl http://192.168.1.120/on
 ;;
 ;;
 [3-9]|[1-2][0-0]*)
 [3-9]|[1-2][0-0]*)
-echo "further"
-echo "3" >/dev/ttyACM0
+echo "Code: many"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "3" >/dev/$Output'
+#curl http://192.168.1.120/on
 ;;
 ;;
 *)
 *)
-echo $test
-echo "error"
-echo "X" >/dev/ttyACM0
+echo "Code: Error"
+sudo bash -c 'Output=$(cat "/tmp/mcled") && echo "X" >/dev/$Output'
+#curl http://192.168.1.120/toggle
 ;;
 ;;
 esac
 esac

+ 0 - 5
scripts/run_minecraft.sh

@@ -1,5 +0,0 @@
-
-#!/bin/sh
-cd ~/minecraft
-#/opt/jdk1.8.0_161/jre/bin/java -Xms512M -Xmx1008M -jar spigot-1.12.2.jar nogui
-java -Dfile.encoding=UTF-8 -Xms256M -Xmx800M -XX:NewSize=300M -XX:MaxNewSize=500M -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -jar spigot-1.12.2.jar nogui

+ 0 - 17
scripts/synchro_openminer.sh

@@ -1,17 +0,0 @@
-#!/bin/bash
-set -e
-echo -e -n "Check NCFTP already installed    : "
-if ! [ -x "$(command -v ncftp)" ]
-then
-echo -e "[\e[91mNO\e[0m]\n"
-sudo apt-get install ncftp -y
-else
-echo -e "[\e[92mOK\e[0m]\n"
-fi
-echo -e "Upload genethos"
-ncftpput -R -v -u "wareck" -p "zorn69" ftpperso.free.fr openrig/ /var/www/folivier/genethos/*
-sleep 5
-echo ""
-echo -e "Upload grinder"
-ncftpput -R -v -u "wareck" -p "zorn69" ftpperso.free.fr grinder/ /var/www/folivier/grinder/*
-sleep 5