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 if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" echo "Trying to restart with sudo" sudo $0 $@ exit fi pin=23 #Enable GPIO23 echo $pin > /sys/class/gpio/export #Set GPIO23 as input echo in > /sys/class/gpio/gpio$pin/direction clear b=0 echo "Not Pressed" while [ 1 ]; do v="$(cat /sys/class/gpio/gpio$pin/value)" if [ "$b" -ne "$v" ] then clear b=$v if [ "$b" -eq "0" ] then echo "Not Pressed" else echo "Pressed" fi fi done
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)