Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#!/bin/bash #IO INTIIALIZATION tshwctl --setdio=65 #System Power ON tshwctl --clrdio=57 #red OFF tshwctl --clrdio=59 #yellow OFF tshwctl --clrdio=61 #Green OFF #CTRL+C Trap_EXIT_EXEC trap ctrl_c INT #trap 'tshwctl --clrdio=65' EXIT function ctrl_c() { #TURN OFF ALL IO tshwctl --clrdio=57 tshwctl --clrdio=59 tshwctl --clrdio=61 tshwctl --clrdio=65 echo "** PROGRAM TERMINATED **" exit } #MAIN Loop for i in $(seq 0 1000) do reading=$(./adc1) #echo $reading if [ $reading -lt 300 ] then clear echo "System Nominal" tshwctl --clrdio=59 tshwctl --clrdio=57 tshwctl --setdio=61 #green ON #Compund logical expansion in BASH elif [[ $reading -gt 301 && $reading -lt 1000 ]]; then tshwctl --clrdio=57 #red OFF clear echo "Intermediate Voltage Detected" tshwctl --setdio=59 #yellow ON tshwctl --setdio=61 #green ON elif [[ $reading -gt 1001 && $reading -lt 2000 ]]; then clear echo "Median Voltage Detected" tshwctl --clrdio=57 #red OFF tshwctl --clrdio=61 #green OFF tshwctl --setdio=59 #yellow ON elif [ $reading -gt 2000 ] then clear echo "Alert! HIGH VOLTAGE DETECTED!" tshwctl --clrdio=61 #green OFF tshwctl --clrdio=59 #yellow OFF tshwctl --setdio=57 #Red ON else tshwctl --clrdio=61 tshwctl --clrdio=59 tshwctl --clrdio=57 fi #sleep 1 done #END LOOP ALL IO IS OFF tshwctl --clrdio=57 tshwctl --clrdio=59 tshwctl --clrdio=61 tshwctl --clrdio=65
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)