Last active
February 2, 2020 11:13
-
-
Save hannes-angst/aa105dc10c4bfcddbfeb3344bfa9db94 to your computer and use it in GitHub Desktop.
Random bytes as hex
This file contains 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 | |
while : | |
do | |
COLOR=`head -c3 </dev/urandom|xxd -p -u` | |
NOW=`date +%Y-%m-%dT%H:%M:%S%z` | |
echo -n "${NOW} - ${COLOR}" | |
mqtt_pub -t "/angst/devices/0017EF8C/led" -m '["'${COLOR}'"]' | |
echo | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
head -c3 </dev/urandom|xxd -p -u
generates a 3-byte hex string for RGB LEDs.