Created
September 2, 2014 06:40
-
-
Save yusukemihara/13756c8ca8df1e24782c to your computer and use it in GitHub Desktop.
dance.rb
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
| # encoding:utf-8 | |
| require 'serialport' | |
| $serial_port = '/dev/ttyUSB0' | |
| $serial_baudrate = 9600 | |
| $serial_databit = 8 | |
| $serial_stopbit = 1 | |
| $serial_paritycheck = 0 | |
| sp = SerialPort.new($serial_port, $serial_baudrate, $serial_databit, $serial_stopbit, $serial_paritycheck) | |
| sp.read_timeout=1000 | |
| m = | |
| [ | |
| 0b00011000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011010, | |
| 0b00100100, | |
| 0b00100100, | |
| 0b01100110, | |
| 0b00000000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011010, | |
| 0b00011000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b00000000, | |
| 0b00110000, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011100, | |
| 0b00011000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b00000000, | |
| 0b00110000, | |
| 0b00111100, | |
| 0b11011010, | |
| 0b00111100, | |
| 0b00101000, | |
| 0b01101000, | |
| 0b00001100, | |
| 0b00000000, | |
| 0b00110000, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011010, | |
| 0b00101000, | |
| 0b00101000, | |
| 0b01101100, | |
| 0b00000000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011010, | |
| 0b00011000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b00001100, | |
| 0b00001100, | |
| 0b00111100, | |
| 0b01011011, | |
| 0b00111100, | |
| 0b00010100, | |
| 0b00010110, | |
| 0b00110000, | |
| 0b00000000, | |
| 0b00001100, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011010, | |
| 0b00010100, | |
| 0b00010100, | |
| 0b00110110, | |
| 0b00011000, | |
| 0b00011000, | |
| 0b00111100, | |
| 0b01011010, | |
| 0b01011010, | |
| 0b00100100, | |
| 0b00100100, | |
| 0b01100110, | |
| ] | |
| i = 0 | |
| loop do | |
| sp.putc m[i%m.size] | |
| sp.putc m[i%m.size] | |
| i += 1 | |
| sleep 0.01 | |
| end | |
| sp.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment