Created
October 20, 2019 03:29
-
-
Save nsnick/eb90ba6cd3893f0f10e9701a71640276 to your computer and use it in GitHub Desktop.
Write a newline to ttyACM0 when it receives an http request on 8080
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Craig Hesling <[email protected]> | |
NC=netcat | |
PORT=8080 | |
SERIAL=/dev/ttyACM0 | |
serial_setup() { | |
stty -F <$SERIAL 115200 | |
} | |
serial_fire() { | |
echo > $SERIAL | |
} | |
# UNCOMMENT ME | |
#serial_setup | |
while true; do | |
$NC -l -p $PORT <<-EOF | |
HTTP/1.1 200 OK | |
Content-Type: text/html; charset=UTF-8 | |
Server: netcat! | |
EOF | |
echo "FIREEEEE!" | |
# UNCOMMENT ME | |
#serial_fire | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment