Mac OS X ambilight
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

epilepsy.sh 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. # The serialHelper115200 file is my own SerialHelper Utility compiled
  3. # with 115200 baud. Get it from here:
  4. # https://github.com/xythobuz/SerialHelper
  5. DATA_FILE=led_data_file
  6. if [ $# -ne 6 ]; then
  7. echo "Usage: two times three hex bytes for color"
  8. echo "$0 r1 g1 b1 r2 g2 b2"
  9. exit
  10. fi
  11. PORTFILE=`ls /dev/tty.wchusbserial* | head -n 1`
  12. echo "Using $PORTFILE as serial port..."
  13. echo "WARNING: This is toggling the LEDs very fast between your two colors!"
  14. echo "The name epilepsy is no joke. Be careful."
  15. read -p "Press ENTER to continue..."
  16. echo "Opening serial port..."
  17. serialHelper115200 -rw $PORTFILE >/dev/null 2>/dev/null &
  18. TERM_PID=$!
  19. echo "PID is $TERM_PID"
  20. echo "Waiting for Arduino to be ready..."
  21. sleep 3
  22. echo
  23. for i in `seq 1 20`; do
  24. echo "Preparing data to send..."
  25. echo -n "xythobuzRGBled" > $DATA_FILE
  26. for i in {1..156}; do
  27. echo -n -e "\x$1\x$2\x$3" >> $DATA_FILE
  28. done
  29. echo "Sending data..."
  30. cat $DATA_FILE > $PORTFILE
  31. echo "Waiting for data to appear..."
  32. sleep 0.05
  33. echo
  34. echo "Preparing data to send..."
  35. echo -n "xythobuzRGBled" > $DATA_FILE
  36. for i in {1..156}; do
  37. echo -n -e "\x$4\x$5\x$6" >> $DATA_FILE
  38. done
  39. echo "Sending data..."
  40. cat $DATA_FILE > $PORTFILE
  41. echo "Waiting for data to appear..."
  42. sleep 0.05
  43. echo
  44. done
  45. echo "Preparing data to send..."
  46. echo -n "xythobuzRGBled" > $DATA_FILE
  47. for i in {1..156}; do
  48. echo -n -e "\x00\x00\x00" >> $DATA_FILE
  49. done
  50. echo "Sending data..."
  51. cat $DATA_FILE > $PORTFILE
  52. echo "Waiting for data to appear..."
  53. sleep 0.1
  54. echo "Closing serial port..."
  55. kill $TERM_PID
  56. echo "Deleting created data file..."
  57. rm -rf $DATA_FILE