├── .gitignore ├── Arduinozyme └── Arduinozyme.ino ├── Makefile ├── README.markdown ├── analog.c ├── analog.h ├── arduino └── Arduinozyme │ └── Arduinozyme.pde ├── hex ├── README.markdown ├── at90usb1286.elf ├── at90usb1286.hex ├── at90usb162.elf ├── at90usb162.hex ├── at90usb646.elf ├── at90usb646.hex ├── atmega32u4.elf └── atmega32u4.hex ├── make.sh ├── projects ├── README.txt ├── blink │ ├── README.txt │ ├── experiment.pl │ ├── instructions.rtf │ ├── results │ │ ├── AKF │ │ ├── CAB │ │ ├── ILK │ │ ├── JPV │ │ ├── MCS │ │ ├── MLW │ │ ├── RAB │ │ ├── ae │ │ ├── avk │ │ ├── crc │ │ ├── crd │ │ ├── hgc │ │ ├── jkl │ │ ├── jsd │ │ ├── jw │ │ ├── krc │ │ ├── mdm │ │ ├── mjd │ │ ├── pjs │ │ └── wca │ └── tally.pl ├── demo │ ├── README.txt │ ├── pulse_outputs.pl │ ├── sequence.pl │ ├── test_inputs.pl │ └── test_outputs.pl ├── javascope │ ├── README.txt │ ├── Scope.java │ └── Timebase.sh ├── matrix │ ├── README.txt │ ├── arrow.pl │ ├── exhibit │ │ ├── ReadMe.md │ │ ├── sparkle_ │ │ │ └── sparkle_.pde │ │ ├── sparkle_fastest │ │ │ └── sparkle_fastest.pde │ │ └── sparkle_fp │ │ │ └── sparkle_fp.pde │ ├── glider.pl │ ├── little-uno.pl │ ├── sparkle.pl │ ├── star.pl │ ├── uno.pl │ └── uno.rtfd │ │ ├── IMG_0388.jpg │ │ └── TXT.rtf ├── moodlites │ ├── ReadMe.md │ ├── cron.sh │ ├── dist.sh │ ├── enumerate.pl │ ├── mood.pl │ ├── old.cron.log │ ├── perl │ │ ├── colors.pl │ │ ├── ducks.pl │ │ ├── fade.pl │ │ ├── fall.pl │ │ ├── glory.pl │ │ ├── meteor.pl │ │ ├── off.pl │ │ ├── popcorn.pl │ │ ├── rainbow.pl │ │ ├── string.pl │ │ └── wipe.pl │ ├── php │ │ ├── Sites.tgz │ │ ├── g35.pl │ │ ├── hdr.pl │ │ ├── normal.pl │ │ └── solid.pl │ ├── show.pl │ ├── sim.log │ └── sim.pl ├── morse │ ├── README.txt │ ├── morse.pl │ └── morse.txt ├── onewire │ ├── DS18B20.pdf │ ├── TeensyduinoOneWire │ │ ├── OneWire.cpp │ │ ├── OneWire.h │ │ ├── examples │ │ │ ├── readme.txt │ │ │ └── sample │ │ │ │ └── sample.pde │ │ └── keywords.txt │ ├── get.pl │ ├── plot.pl │ ├── record.sh │ ├── scan.pl │ └── test.pl ├── perlscope │ ├── README.txt │ └── scope.sh ├── ping │ ├── 28015-PING-v1.6.pdf │ ├── README.txt │ ├── ping.sh │ ├── range.sh │ └── stats.sh ├── remote │ ├── README.txt │ ├── blink.sh │ ├── public │ │ ├── css │ │ │ └── overcast │ │ │ │ ├── images │ │ │ │ ├── ui-anim_basic_16x16.gif │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ ├── ui-bg_flat_0_eeeeee_40x100.png │ │ │ │ ├── ui-bg_flat_55_c0402a_40x100.png │ │ │ │ ├── ui-bg_flat_55_eeeeee_40x100.png │ │ │ │ ├── ui-bg_glass_100_f8f8f8_1x400.png │ │ │ │ ├── ui-bg_glass_35_dddddd_1x400.png │ │ │ │ ├── ui-bg_glass_60_eeeeee_1x400.png │ │ │ │ ├── ui-bg_inset-hard_75_999999_1x100.png │ │ │ │ ├── ui-bg_inset-soft_50_c9c9c9_1x100.png │ │ │ │ ├── ui-icons_3383bb_256x240.png │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ ├── ui-icons_70b2e1_256x240.png │ │ │ │ ├── ui-icons_999999_256x240.png │ │ │ │ └── ui-icons_fbc856_256x240.png │ │ │ │ └── jquery-ui-1.8.2.custom.css │ │ ├── development-bundle │ │ │ ├── AUTHORS.txt │ │ │ ├── GPL-LICENSE.txt │ │ │ ├── MIT-LICENSE.txt │ │ │ ├── demos │ │ │ │ ├── demos.css │ │ │ │ ├── images │ │ │ │ │ ├── calendar.gif │ │ │ │ │ ├── demo-config-on-tile.gif │ │ │ │ │ ├── demo-config-on.gif │ │ │ │ │ ├── demo-spindown-closed.gif │ │ │ │ │ ├── demo-spindown-open.gif │ │ │ │ │ ├── icon-docs-info.gif │ │ │ │ │ ├── jquery_32x32.png │ │ │ │ │ ├── jqueryui_32x32.png │ │ │ │ │ ├── pbar-ani.gif │ │ │ │ │ ├── sizzlejs_32x32.png │ │ │ │ │ └── transparent_1x1.png │ │ │ │ ├── index.html │ │ │ │ └── slider │ │ │ │ │ ├── colorpicker.html │ │ │ │ │ ├── default.html │ │ │ │ │ ├── hotelrooms.html │ │ │ │ │ ├── index.html │ │ │ │ │ ├── multiple-vertical.html │ │ │ │ │ ├── range-vertical.html │ │ │ │ │ ├── range.html │ │ │ │ │ ├── rangemax.html │ │ │ │ │ ├── rangemin.html │ │ │ │ │ ├── side-scroll.html │ │ │ │ │ ├── slider-vertical.html │ │ │ │ │ ├── steps.html │ │ │ │ │ └── tabs.html │ │ │ ├── docs │ │ │ │ └── slider.html │ │ │ ├── external │ │ │ │ ├── jquery.bgiframe-2.1.1.js │ │ │ │ ├── jquery.cookie.js │ │ │ │ ├── jquery.metadata.js │ │ │ │ ├── qunit.css │ │ │ │ └── qunit.js │ │ │ ├── jquery-1.4.2.js │ │ │ ├── themes │ │ │ │ └── base │ │ │ │ │ ├── images │ │ │ │ │ ├── ui-anim_basic_16x16.gif │ │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ │ ├── ui-icons_888888_256x240.png │ │ │ │ │ └── ui-icons_cd0a0a_256x240.png │ │ │ │ │ ├── jquery.ui.all.css │ │ │ │ │ ├── jquery.ui.base.css │ │ │ │ │ ├── jquery.ui.core.css │ │ │ │ │ ├── jquery.ui.slider.css │ │ │ │ │ └── jquery.ui.theme.css │ │ │ ├── ui │ │ │ │ ├── jquery-ui-1.8.2.custom.js │ │ │ │ ├── jquery.ui.core.js │ │ │ │ ├── jquery.ui.mouse.js │ │ │ │ ├── jquery.ui.slider.js │ │ │ │ ├── jquery.ui.widget.js │ │ │ │ └── minified │ │ │ │ │ ├── jquery.ui.core.min.js │ │ │ │ │ ├── jquery.ui.mouse.min.js │ │ │ │ │ ├── jquery.ui.slider.min.js │ │ │ │ │ └── jquery.ui.widget.min.js │ │ │ └── version.txt │ │ ├── flot │ │ │ ├── API.txt │ │ │ ├── FAQ.txt │ │ │ ├── LICENSE.txt │ │ │ ├── Makefile │ │ │ ├── NEWS.txt │ │ │ ├── PLUGINS.txt │ │ │ ├── README.txt │ │ │ ├── examples │ │ │ │ ├── ajax.html │ │ │ │ ├── annotating.html │ │ │ │ ├── arrow-down.gif │ │ │ │ ├── arrow-left.gif │ │ │ │ ├── arrow-right.gif │ │ │ │ ├── arrow-up.gif │ │ │ │ ├── basic.html │ │ │ │ ├── data-eu-gdp-growth-1.json │ │ │ │ ├── data-eu-gdp-growth-2.json │ │ │ │ ├── data-eu-gdp-growth-3.json │ │ │ │ ├── data-eu-gdp-growth-4.json │ │ │ │ ├── data-eu-gdp-growth-5.json │ │ │ │ ├── data-eu-gdp-growth.json │ │ │ │ ├── data-japan-gdp-growth.json │ │ │ │ ├── data-usa-gdp-growth.json │ │ │ │ ├── dual-axis.html │ │ │ │ ├── graph-types.html │ │ │ │ ├── hs-2004-27-a-large_web.jpg │ │ │ │ ├── image.html │ │ │ │ ├── index.html │ │ │ │ ├── interacting.html │ │ │ │ ├── layout.css │ │ │ │ ├── navigate.html │ │ │ │ ├── selection.html │ │ │ │ ├── setting-options.html │ │ │ │ ├── stacking.html │ │ │ │ ├── thresholding.html │ │ │ │ ├── time.html │ │ │ │ ├── tracking.html │ │ │ │ ├── turning-series.html │ │ │ │ ├── visitors.html │ │ │ │ └── zooming.html │ │ │ ├── excanvas.js │ │ │ ├── excanvas.min.js │ │ │ ├── jquery.colorhelpers.js │ │ │ ├── jquery.colorhelpers.min.js │ │ │ ├── jquery.flot.crosshair.js │ │ │ ├── jquery.flot.crosshair.min.js │ │ │ ├── jquery.flot.image.js │ │ │ ├── jquery.flot.image.min.js │ │ │ ├── jquery.flot.js │ │ │ ├── jquery.flot.min.js │ │ │ ├── jquery.flot.navigate.js │ │ │ ├── jquery.flot.navigate.min.js │ │ │ ├── jquery.flot.selection.js │ │ │ ├── jquery.flot.selection.min.js │ │ │ ├── jquery.flot.stack.js │ │ │ ├── jquery.flot.stack.min.js │ │ │ ├── jquery.flot.threshold.js │ │ │ ├── jquery.flot.threshold.min.js │ │ │ ├── jquery.js │ │ │ └── jquery.min.js │ │ ├── js │ │ │ ├── jquery-1.4.2.min.js │ │ │ └── jquery-ui-1.8.2.custom.min.js │ │ └── remote.js │ ├── server.rb │ └── views │ │ ├── index.haml │ │ ├── layout.haml │ │ ├── stylesheet.sass │ │ └── upload.haml ├── robot │ ├── L298N.pdf │ ├── MotorControl.jpg │ ├── cgi │ │ ├── blink.cgi │ │ ├── brag.cgi │ │ ├── click.cgi │ │ ├── dance.cgi │ │ ├── sing.cgi │ │ ├── source.cgi │ │ ├── step-backward.cgi │ │ ├── step-forward.cgi │ │ ├── turn-left.cgi │ │ ├── turn-right.cgi │ │ └── wag.cgi │ ├── dance.pl │ ├── move.pl │ ├── pull-vn.sh │ └── walk.pl ├── servo │ └── pointer.sh └── yow │ ├── AV02-0662EN.pdf │ ├── pins.rtfd │ ├── Pasted Graphic 2.tiff │ ├── Pasted Graphic.tiff │ └── TXT.rtf │ ├── thermz.pl │ └── yowz.pl ├── txtzyme.c ├── txtzyme_quick_start.rtf ├── usb_serial.c └── usb_serial.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.eep 2 | *.lss 3 | *.lst 4 | *.map 5 | *.o 6 | *.sym 7 | cu 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /Arduinozyme/Arduinozyme.ino: -------------------------------------------------------------------------------- 1 | 2 | unsigned int x = 0; 3 | int d = 13; 4 | const unsigned int bufsize = 1650; // 2048 is too large for Arduino Uno 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | //txtEval("10d10T 1000m 2T 1000m 0T 0o\r\n"); // hint for a startup command 9 | } 10 | 11 | void loop() { 12 | char buf[bufsize]; 13 | txtRead(buf, bufsize); // wait for commands 14 | txtEval(buf); 15 | } 16 | 17 | void txtRead (char *p, unsigned int n) { 18 | unsigned int i = 0; 19 | while (i < (n-1)) { 20 | while (!Serial.available()); // loop while waiting for input 21 | char ch = Serial.read(); 22 | if (ch == '\r' || ch == '\n') break; 23 | if (ch >= ' ' && ch <= '~') { 24 | *p++ = ch; 25 | i++; 26 | } 27 | } 28 | *p = 0; 29 | } 30 | 31 | void txtEval (char *buf) { 32 | unsigned int k = 0; 33 | char *loop; 34 | char ch; 35 | while ((ch = *buf++)) { 36 | switch (ch) { 37 | case '0': 38 | case '1': 39 | case '2': 40 | case '3': 41 | case '4': 42 | case '5': 43 | case '6': 44 | case '7': 45 | case '8': 46 | case '9': 47 | x = ch - '0'; 48 | while (*buf >= '0' && *buf <= '9') { 49 | x = x*10 + (*buf++ - '0'); 50 | } 51 | break; 52 | case 'p': 53 | Serial.println(x); 54 | break; 55 | case 'd': 56 | d = x; 57 | break; 58 | case 'i': 59 | pinMode(d,INPUT); 60 | case 'r': 61 | x = digitalRead(d); 62 | break; 63 | case 'o': 64 | pinMode(d,OUTPUT); 65 | digitalWrite(d, x%2); 66 | break; 67 | case 'O': // write analog 68 | pinMode(d,OUTPUT); 69 | analogWrite(d,x); 70 | break; 71 | // Teensy 3.1 and 3.0 specifc code 72 | #if defined(__MK20DX256__)|| defined(__MK20DX128__) 73 | case 'F': // See https://www.pjrc.com/teensy/td_pulse.html 74 | analogWriteFrequency(d,x); 75 | break; 76 | case 'R': // Teensy3 bits of resolution 2-16 default was 8 77 | analogWriteResolution(x); 78 | break; 79 | #endif 80 | case 'T': 81 | if (x ==0 ) 82 | noTone(d); 83 | else 84 | tone(d,x); 85 | break; 86 | case 'm': 87 | delay(x); 88 | break; 89 | case '{': 90 | k = x; 91 | loop = buf; 92 | while ((ch = *buf++) && ch != '}') { 93 | } 94 | case '}': 95 | if (k) { 96 | k--; 97 | buf = loop; 98 | } 99 | break; 100 | case 'k': 101 | x = k; 102 | break; 103 | case '_': 104 | while ((ch = *buf++) && ch != '_') { 105 | Serial.print(ch); 106 | } 107 | Serial.println(); 108 | break; 109 | case 's': 110 | x = analogRead(x); 111 | break; 112 | } 113 | } 114 | } 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/Makefile -------------------------------------------------------------------------------- /analog.c: -------------------------------------------------------------------------------- 1 | // Simple analog to digitial conversion 2 | 3 | #include 4 | #include 5 | #include 6 | #include "analog.h" 7 | 8 | 9 | #if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) 10 | static uint8_t aref = (1<= 12) return 0; 30 | return adc_read(pgm_read_byte(pin_to_mux + pin)); 31 | #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) 32 | if (pin >= 8) return 0; 33 | return adc_read(pin); 34 | #else 35 | return 0; 36 | #endif 37 | } 38 | 39 | // Mux input 40 | int16_t adc_read(uint8_t mux) 41 | { 42 | #if defined(__AVR_AT90USB162__) 43 | return 0; 44 | #else 45 | uint8_t low; 46 | 47 | ADCSRA = (1< 5 | 6 | void analogReference(uint8_t mode); 7 | int16_t analogRead(uint8_t pin); 8 | int16_t adc_read(uint8_t mux); 9 | 10 | #define ADC_REF_POWER (1<= ' ' && ch <= '~') { 22 | *p++ = ch; 23 | i++; 24 | } 25 | } 26 | *p = 0; 27 | } 28 | 29 | void txtEval (char *buf) { 30 | unsigned int k = 0; 31 | char *loop; 32 | char ch; 33 | while ((ch = *buf++)) { 34 | switch (ch) { 35 | case '0': 36 | case '1': 37 | case '2': 38 | case '3': 39 | case '4': 40 | case '5': 41 | case '6': 42 | case '7': 43 | case '8': 44 | case '9': 45 | x = ch - '0'; 46 | while (*buf >= '0' && *buf <= '9') { 47 | x = x*10 + (*buf++ - '0'); 48 | } 49 | break; 50 | case 'p': 51 | Serial.println(x); 52 | break; 53 | case 'd': 54 | d = x; 55 | break; 56 | case 'i': 57 | x = digitalRead(d); 58 | break; 59 | case 'o': 60 | digitalWrite(d, x%2); 61 | break; 62 | case 'm': 63 | delay(x); 64 | break; 65 | case 'u': 66 | delayMicroseconds(x); 67 | break; 68 | case '{': 69 | k = x; 70 | loop = buf; 71 | while ((ch = *buf++) && ch != '}') { 72 | } 73 | case '}': 74 | if (k) { 75 | k--; 76 | buf = loop; 77 | } 78 | break; 79 | case 'k': 80 | x = k; 81 | break; 82 | case '_': 83 | while ((ch = *buf++) && ch != '_') { 84 | Serial.print(ch); 85 | } 86 | Serial.println(); 87 | break; 88 | case 's': 89 | x = analogRead(x); 90 | break; 91 | } 92 | } 93 | } 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /hex/README.markdown: -------------------------------------------------------------------------------- 1 | Pre-Built Txtzyme Hex Files 2 | =========================== 3 | 4 | Txtzyme runs on Teensy and Teensy++ versions 1.0 and 2.0. These devices are available, inexpensive and well supported by . Once you are in possession of a device you will need to: 5 | 6 | - Download the Teensy loader from 7 | - Download Txtzyme hex from 8 | 9 | Choose the hex file that corresponds to your Teensy. 10 | The correspondences are as follows: 11 | 12 | - `at90usb1286.hex` for Teensy++ 2.0 13 | - `at90usb162.hex` for Teensy 1.0 14 | - `at90usb646.hex` for Teensy++ 1.0 15 | - `atmega32u4.hex` for Teensy 2.0 16 | 17 | You can download the .elf file that corresponds to your Teensy. If you do, then the Teensy loader 18 | will check that you are actually programming the correct part as specified in the .elf file. 19 | 20 | Once Txtzyme is running you can send commands to it from the shell. 21 | Here is how to send a "blink" program from an OS X Terminal window: 22 | 23 | $ echo '5{ 6d 1o 100m 0o 100m }' >/dev/cu.usbmodem12341 24 | 25 | You can generate Txtzyme as you would any other text file. 26 | Here is how you can grab the text output from the morse project and run it: 27 | 28 | $ curl http://github.com/WardCunningham/Txtzyme/raw/master/projects/morse/morse.txt >/dev/cu.usbmodem12341 29 | 30 | Expect this to blink out a familiar message in Morse code. 31 | -------------------------------------------------------------------------------- /hex/at90usb1286.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/hex/at90usb1286.elf -------------------------------------------------------------------------------- /hex/at90usb162.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/hex/at90usb162.elf -------------------------------------------------------------------------------- /hex/at90usb646.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/hex/at90usb646.elf -------------------------------------------------------------------------------- /hex/atmega32u4.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/hex/atmega32u4.elf -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | for mcu in `grep 'MCU =' Makefile | cut -f 3 -d ' '` 2 | do echo ============= $mcu ============== 3 | cat Makefile | 4 | perl -pe ' 5 | s/^MCU = /#MCU = /; 6 | s/^#(MCU = '$mcu')/$1/; 7 | ' > /tmp/txtzyme_makefile 8 | # head -60 /tmp/txtzyme_makefile 9 | make clean 10 | make -f /tmp/txtzyme_makefile 11 | mv txtzyme.hex hex/$mcu.hex 12 | mv txtzyme.elf hex/$mcu.elf 13 | done 14 | make clean 15 | rm /tmp/txtzyme_makefile 16 | -------------------------------------------------------------------------------- /projects/README.txt: -------------------------------------------------------------------------------- 1 | Txtzyme Projects 2 | ---------------- 3 | 4 | We are collecting small projects that illustrate the versitility of the Txtzyme interpreter. Please let us copy your work here. Let us know when they are featured enough to understand the value of an approach, but not so fully featured as to make adapting difficult. 5 | 6 | 7 | Things to Try 8 | ------------- 9 | 10 | * Morse -- Perl script writes macro expanded text to server. 11 | * Perlscope -- Perl program reads usb in background while user tries different programs. 12 | * Javascope -- Java program that reads and plots usb output in the background. 13 | * Blink -- Program randomly generates programs; reads data from user, logs and reports both. 14 | * Remote -- Sinatra (Ruby) application that serves access to local sensor network. 15 | * Onewire -- Perl to find and query DS18B20 one-wire digital thermometers. 16 | * Yow -- Perl to light up an Avago HDLx-2416 Series four-character alphanumeric display. 17 | * Ping -- Shell scripts to exercise the #28015 Ultrasonic Distance Sensor. -------------------------------------------------------------------------------- /projects/blink/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Blink 3 | ------------- 4 | by Ward Cunningham 5 | 6 | This project conducts an experiment in visual perception. While testing Txtzyme example programs I found that I could see LED blinks uniformly and distinctly but that I could not count them correctly. Could I be observing some rate limit deep within my perceptual system? 7 | 8 | To test this hypothesis I wrote a Mac specific experiment manager. I chose to offer instruction mostly with voice synthesis and to collect responses with single keystrokes so that the subject's attention could remain focused on the experiment. 9 | 10 | Things to Try 11 | ------------- 12 | 13 | Try collecting data from yourself and your friends. 14 | 15 | $ open instructions.rtf 16 | $ perl experiment.pl 17 | 18 | This will display instructions and then collect data through mechanisms suitable for volunteer participation at a club meeting. Results are timestamped and stored under the subject's initials within the results directory. 19 | 20 | $ perl tally.pl 21 | $ perl tally.pl 10 22 | 23 | This script reads and counts responses from all subjects. The results are then printed in tab-separated columns, one for each possible response, with each row corresponding to the stimulus half-cycle period in milliseconds, optionally clumped into bins. Here are some of my first results: 24 | 25 | 1 2 3 4 5 6 7 8 9 26 | 27 | 50 28 | 51 29 | 52 1 30 | 53 1 1 1 31 | 54 1 32 | 55 33 | 56 1 34 | 57 35 | 58 36 | 59 2 1 37 | 60 1 38 | 61 39 | 62 1 40 | 63 1 41 | 64 42 | 65 2 43 | 66 1 44 | 67 45 | 68 2 46 | 69 47 | 48 | 49 | More Experiments 50 | ---------------- 51 | 52 | You may want to try variations of this experiment changing environmental factors, like room illumination, time of day, age of subject or quantity of beer. You can also revise the script varying blink count, brightness or non-random presentation. Try adding an initial training session before collecting data. Sensitize your subjects by speaking some desired result before each trial. Compare their response to audible beeps instead of visual blinks. Add switches and solenoids to operant-condition your pets. 53 | -------------------------------------------------------------------------------- /projects/blink/experiment.pl: -------------------------------------------------------------------------------- 1 | # conduct perception experiment 2 | # (apple osx specific implementation) 3 | 4 | my $stty = `stty -g`; 5 | my $teensy = '/dev/cu.usbmodem12341'; 6 | mkdir 'results' unless -e 'results'; 7 | 8 | die("can't find teensy\n") unless -e $teensy; 9 | `echo 6d0o >$teensy`; 10 | 11 | while () { 12 | print "enter your initials: "; 13 | experiment($1) if <> =~ /(\w{2,3})/; 14 | sleep 3; 15 | `say next`; 16 | } 17 | 18 | sub experiment { 19 | my ($initials) = @_; 20 | `stty -icanon -echo`; 21 | `say ready`; 22 | `echo trial \`date +%s\` >> results/$initials`; 23 | for $period (split(/\s+/, `jot -r 10 50 250`)) { 24 | my $result; 25 | while() { 26 | `echo 300m5{1o${period}m0o${period}m} >$teensy`; 27 | $result = getc; 28 | last if $result =~ /[1-9]/; 29 | `say again`; 30 | } 31 | `say good`; 32 | `echo "$period\t$result" >> results/$initials`; 33 | } 34 | `say thank you`; 35 | `stty $stty`; 36 | } 37 | -------------------------------------------------------------------------------- /projects/blink/instructions.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf290 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww10960\viewh9600\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural 6 | 7 | \f0\fs44 \cf0 \ 8 | \ 9 | \ 10 | We're testing how people perceive blinking.\ 11 | \ 12 | We show you a light that blinks 1 to 9 times.\ 13 | 14 | \b\fs50 Type the number of times the light blinks.\ 15 | 16 | \b0\fs44 \ 17 | We'll try 10 different blinking rates.\ 18 | 19 | \b\fs50 Press DELETE to repeat any trial. 20 | \b0\fs44 \ 21 | \ 22 | Type your initials to begin.\ 23 | Try again and again as the night goes on.} -------------------------------------------------------------------------------- /projects/blink/results/AKF: -------------------------------------------------------------------------------- 1 | trial 1276575958 2 | 84 6 3 | 110 6 4 | 56 5 5 | 104 6 6 | 144 6 7 | 78 6 8 | 125 5 9 | 130 5 10 | 148 6 11 | 145 6 12 | -------------------------------------------------------------------------------- /projects/blink/results/CAB: -------------------------------------------------------------------------------- 1 | trial 1276742201 2 | 95 4 3 | 230 5 4 | 243 5 5 | 217 5 6 | 211 5 7 | 204 5 8 | 195 5 9 | 82 4 10 | 169 5 11 | 99 4 12 | trial 1276742375 13 | 213 5 14 | 86 4 15 | 64 4 16 | 124 4 17 | 153 4 18 | 182 5 19 | 154 5 20 | 64 4 21 | 182 5 22 | 224 5 23 | -------------------------------------------------------------------------------- /projects/blink/results/ILK: -------------------------------------------------------------------------------- 1 | trial 1276575805 2 | 134 5 3 | 143 5 4 | 86 5 5 | 134 5 6 | 98 6 7 | 59 5 8 | 100 5 9 | 126 6 10 | 86 6 11 | 52 6 12 | -------------------------------------------------------------------------------- /projects/blink/results/JPV: -------------------------------------------------------------------------------- 1 | trial 1276575249 2 | 103 5 3 | 100 5 4 | 103 5 5 | 127 5 6 | 149 5 7 | 53 5 8 | 107 5 9 | 147 5 10 | 65 3 11 | 97 5 12 | -------------------------------------------------------------------------------- /projects/blink/results/MCS: -------------------------------------------------------------------------------- 1 | trial 1276575912 2 | 63 4 3 | 77 4 4 | 73 4 5 | 116 5 6 | 83 4 7 | 128 5 8 | 91 4 9 | 133 5 10 | 59 4 11 | 87 4 12 | -------------------------------------------------------------------------------- /projects/blink/results/MLW: -------------------------------------------------------------------------------- 1 | trial 1276575737 2 | 104 4 3 | 138 4 4 | 150 5 5 | 124 4 6 | 134 5 7 | 60 4 8 | 136 5 9 | 68 4 10 | 122 5 11 | 139 5 12 | -------------------------------------------------------------------------------- /projects/blink/results/RAB: -------------------------------------------------------------------------------- 1 | trial 1276575859 2 | 149 5 3 | 123 5 4 | 66 5 5 | 73 5 6 | 137 5 7 | 123 4 8 | 127 5 9 | 95 5 10 | 59 4 11 | 113 5 12 | -------------------------------------------------------------------------------- /projects/blink/results/ae: -------------------------------------------------------------------------------- 1 | trial 1277181383 2 | 78 5 3 | 100 5 4 | 143 5 5 | 118 4 6 | 73 4 7 | 185 5 8 | 103 4 9 | 78 4 10 | 191 5 11 | 74 4 12 | -------------------------------------------------------------------------------- /projects/blink/results/avk: -------------------------------------------------------------------------------- 1 | trial 1277180762 2 | 170 6 3 | 117 5 4 | 119 7 5 | 80 4 6 | 219 5 7 | 167 5 8 | 198 5 9 | 203 5 10 | 140 4 11 | 128 6 12 | -------------------------------------------------------------------------------- /projects/blink/results/crc: -------------------------------------------------------------------------------- 1 | trial 1276620501 2 | 221 5 3 | 193 9 4 | 149 5 5 | 112 4 6 | 126 4 7 | 112 4 8 | 116 4 9 | 170 5 10 | 247 5 11 | 139 5 12 | trial 1276620541 13 | 120 5 14 | 121 4 15 | 198 5 16 | 67 4 17 | 235 5 18 | 198 5 19 | 231 5 20 | 177 5 21 | 108 4 22 | 74 4 23 | -------------------------------------------------------------------------------- /projects/blink/results/crd: -------------------------------------------------------------------------------- 1 | trial 1277181515 2 | 87 5 3 | 84 5 4 | 189 5 5 | 100 5 6 | 141 6 7 | 227 5 8 | 72 4 9 | 105 5 10 | 184 5 11 | 148 6 12 | -------------------------------------------------------------------------------- /projects/blink/results/hgc: -------------------------------------------------------------------------------- 1 | trial 1276624982 2 | 243 5 3 | 173 5 4 | 120 4 5 | 131 4 6 | 191 5 7 | 130 4 8 | 249 5 9 | 149 4 10 | 96 3 11 | 212 5 12 | trial 1276625056 13 | 116 4 14 | 186 5 15 | 186 5 16 | 169 5 17 | 88 3 18 | 124 4 19 | 202 4 20 | 170 4 21 | 168 4 22 | 138 4 23 | trial 1276625184 24 | 87 3 25 | 182 4 26 | 115 4 27 | 97 3 28 | 244 5 29 | 168 5 30 | 203 5 31 | 221 5 32 | 216 5 33 | 206 5 34 | trial 1276625263 35 | 78 4 36 | 51 3 37 | 153 4 38 | 153 4 39 | 218 5 40 | 248 5 41 | 139 4 42 | 194 4 43 | 137 4 44 | 198 5 45 | trial 1276625312 46 | 71 3 47 | 183 4 48 | 129 4 49 | 154 4 50 | 184 4 51 | 140 4 52 | 201 4 53 | 159 4 54 | 191 5 55 | 119 4 56 | trial 1276625364 57 | 230 5 58 | 52 3 59 | 125 4 60 | 202 5 61 | 232 5 62 | 106 3 63 | 221 5 64 | 151 4 65 | 156 4 66 | 99 3 67 | trial 1276625440 68 | 225 5 69 | 53 3 70 | 139 4 71 | 220 5 72 | 230 5 73 | 207 5 74 | 149 4 75 | 61 3 76 | 223 5 77 | 236 5 78 | trial 1276625498 79 | 156 4 80 | 168 5 81 | 140 4 82 | 132 4 83 | 250 5 84 | 95 4 85 | 74 3 86 | 58 3 87 | 92 4 88 | 226 5 89 | -------------------------------------------------------------------------------- /projects/blink/results/jkl: -------------------------------------------------------------------------------- 1 | trial 1277180948 2 | 135 4 3 | 154 4 4 | 165 4 5 | 57 2 6 | 230 5 7 | 172 5 8 | 130 4 9 | 215 5 10 | 56 3 11 | 203 4 12 | -------------------------------------------------------------------------------- /projects/blink/results/jsd: -------------------------------------------------------------------------------- 1 | trial 1277183055 2 | 233 5 3 | 86 5 4 | 215 5 5 | 91 4 6 | 159 5 7 | 132 5 8 | 107 5 9 | 81 5 10 | 94 5 11 | 147 5 12 | -------------------------------------------------------------------------------- /projects/blink/results/jw: -------------------------------------------------------------------------------- 1 | trial 1277181057 2 | 134 5 3 | 85 4 4 | 155 5 5 | 150 4 6 | 157 5 7 | 66 4 8 | 65 4 9 | 66 4 10 | 123 4 11 | 112 4 12 | -------------------------------------------------------------------------------- /projects/blink/results/krc: -------------------------------------------------------------------------------- 1 | trial 1276623481 2 | 232 5 3 | 221 5 4 | 156 5 5 | 136 4 6 | 155 5 7 | 211 5 8 | 99 4 9 | 139 5 10 | 203 5 11 | 116 4 12 | trial 1276623532 13 | 188 5 14 | 104 4 15 | 215 5 16 | 206 5 17 | 167 5 18 | 151 4 19 | 166 4 20 | 186 5 21 | 72 4 22 | 165 5 23 | -------------------------------------------------------------------------------- /projects/blink/results/mdm: -------------------------------------------------------------------------------- 1 | trial 1277183000 2 | 182 5 3 | 96 5 4 | 127 5 5 | 117 5 6 | 167 5 7 | 126 5 8 | 97 5 9 | 201 6 10 | 70 4 11 | 151 5 12 | -------------------------------------------------------------------------------- /projects/blink/results/mjd: -------------------------------------------------------------------------------- 1 | trial 1277180684 2 | 130 7 3 | 244 3 4 | 139 4 5 | 205 5 6 | 145 5 7 | 205 5 8 | 226 4 9 | 70 3 10 | 145 4 11 | 94 3 12 | -------------------------------------------------------------------------------- /projects/blink/results/pjs: -------------------------------------------------------------------------------- 1 | trial 1277182852 2 | 230 5 3 | 156 5 4 | 207 5 5 | 221 5 6 | 157 5 7 | 202 5 8 | 164 5 9 | 65 6 10 | 51 5 11 | 58 5 12 | -------------------------------------------------------------------------------- /projects/blink/results/wca: -------------------------------------------------------------------------------- 1 | trial 1277181790 2 | 240 5 3 | 146 5 4 | 182 5 5 | 75 5 6 | 145 5 7 | 232 5 8 | 238 5 9 | 69 5 10 | 185 5 11 | 90 5 12 | -------------------------------------------------------------------------------- /projects/blink/tally.pl: -------------------------------------------------------------------------------- 1 | my %tally; 2 | my $binsize = $ARGV[0] || 1; 3 | print "bin: $binsize\n"; 4 | 5 | for () { 6 | my @lines = `cat $_`; 7 | for (@lines) { 8 | next unless /(\d+)\t(\d)/; 9 | my $t = $1 - ($1 % $binsize); 10 | $tally{"$t $2"}++; 11 | } 12 | } 13 | 14 | print "\t", join("\t", 1..9), "\n\n"; 15 | for (my $t=50-(50 % $binsize); $t<=250; $t+=$binsize) { 16 | print $t, "\t"; 17 | for my $c (1 .. 9) { 18 | print $tally{"$t $c"}, "\t"; 19 | } 20 | print "\n"; 21 | } -------------------------------------------------------------------------------- /projects/demo/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Demo 3 | ----------------- 4 | by Ward Cunningham 5 | 6 | Paul has built a family of demo boards for Teensy and Teensy++ computers. These boards have buttons and leds on every io pin and pots on analog input pins. This project includes some simple testing of board resources and a little bit of show-off blinking lights. 7 | 8 | 9 | Things To Try 10 | ------------- 11 | 12 | Test the outputs of a demo board. This script uses the mac "say" program to blink each led in turn as it identifies the led verbally. 13 | 14 | $ perl test_outputs.pl 15 | 16 | Test inputs of a demo board. This script reads each button and then blinks the led corresponding to any pressed buttons. Try adjusting the pots on analog inputs. We are reading those pins as logic so they will appear as a pressed button when adjusted above the digital logic threshold. 17 | 18 | $ perl test_inputs.pl 19 | 20 | Try blinking lots of lights. 21 | 22 | $ perl sequence.pl 23 | 24 | If you have more than one demo board, plug them all in and run sequence on all of them. 25 | 26 | $ for i in /dev/cu.usbmodem*; do (perl sequence.pl $i &); done; -------------------------------------------------------------------------------- /projects/demo/pulse_outputs.pl: -------------------------------------------------------------------------------- 1 | 2 | # Open unbuffered bidirectional serial Teensy connection 3 | open T, '+; $_ =~ s/\r?\n?$//; $_ } 10 | 11 | # Sync up with Txtzyme 12 | putz "_ok_"; $_ = getz until /ok/; 13 | print "running\n"; 14 | 15 | $version = getz "v"; 16 | print "detected $version\n"; 17 | 18 | # Teensy 2.0 19 | if ($version eq 'atmega32u4') { 20 | @top = ('0f','1f','4f','5f','6f','7f','6b','5b','4b','7d','6d'); 21 | @mid_top = ('4d'); 22 | @mid_bot = ('6e','5d'); 23 | @bot = ('0b','1b','2b','3b','7b','0d','1d','2d','3d','6c','7c'); 24 | } 25 | 26 | # Teensy++ 1.0 or 2.0 27 | if ($version eq 'at90usb1286' or $version eq 'at90usb646') { 28 | @top = ('6b','5b','4b','3b','2b','1b','0b','7e','6e','0f','1f','2f','3f','4f','5f','6f','7f'); 29 | @mid_top = ('4e','0a','1a','2a','3a'); 30 | @mid_bot = ('5e','4a','5a','6a','7a'); 31 | @bot = ('7b','0d','1d','2d','3d','4d','5d','6d','7d','0e','1e','0c','1c','2c','3c','4c','5c','6c','7c'); 32 | } 33 | 34 | @all = (@top, @mid_top, @mid_bot, @bot); 35 | 36 | # pulse each pin, in order, over and over 37 | # good for looking for shorts with a scope 38 | 39 | for (@all) { putz $_, "0oi" } 40 | while(1) { 41 | for (@all) { putz $_, "1o0oi" } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /projects/demo/sequence.pl: -------------------------------------------------------------------------------- 1 | 2 | # Open unbuffered bidirectional serial Teensy connection 3 | $t = $ARGV[0]||'/dev/cu.usbmodem12341'; 4 | open T, "+<$t" or die($!); 5 | select T; $| = 1; 6 | select STDOUT; $| = 1; 7 | 8 | # Read and Write Txtzyme 9 | sub putz { local $_; print T map "$_\n", @_ or die($!) } 10 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 11 | 12 | # Sync up with Txtzyme 13 | putz "_ok_"; $_ = getz until /ok/; 14 | print "running $t\n"; 15 | 16 | $version = getz "v"; 17 | print "detected $version\n"; 18 | 19 | # Teensy 2.0 20 | if ($version eq 'atmega32u4') { 21 | @top = ('0f','1f','4f','5f','6f','7f','6b','5b','4b','7d','6d'); 22 | @mid_top = ('4d'); 23 | @mid_bot = ('6e','5d'); 24 | @bot = ('0b','1b','2b','3b','7b','0d','1d','2d','3d','6c','7c'); 25 | } 26 | 27 | # Teensy++ 2.0 28 | if ($version eq 'at90usb1286') { 29 | @top = ('6b','5b','4b','3b','2b','1b','0b','7e','6e','0f','1f','2f','3f','4f','5f','6f','7f'); 30 | @mid_top = ('4e','0a','1a','2a','3a'); 31 | @mid_bot = ('5e','4a','5a','6a','7a'); 32 | @bot = ('7b','0d','1d','2d','3d','4d','5d','6d','7d','0e','1e','0c','1c','2c','3c','4c','5c','6c','7c'); 33 | } 34 | 35 | @all = (@top, @mid_top, @mid_bot, @bot); 36 | 37 | use List::Util qw(first max maxstr min minstr reduce shuffle sum); 38 | 39 | # Reversed 40 | @top_rev = reverse(@top); 41 | @bot_rev = reverse(@bot); 42 | @mid_top_rev = reverse(@mid_top); 43 | @mid_bot_rev = reverse(@mid_bot); 44 | 45 | # Combined 46 | @edge = (@top, @bot_rev); 47 | @edge_rev = reverse(@edge); 48 | @all = (@top, @mid_top_rev, @mid_bot, @bot_rev); 49 | 50 | while (1) { 51 | 52 | # Flash 53 | for $b (1..8) { 54 | putz map("$_ $b o", @all); 55 | putz "250m"; 56 | } 57 | 58 | # Run 59 | for $b (1..10) { 60 | putz map("$_ $b o 8m", @edge); 61 | } 62 | 63 | # Sparkle 64 | for (1..2) { 65 | putz map("$_ 1o 100m 0o\n", shuffle(@all)); 66 | } 67 | 68 | # Race 69 | for (1..5) { 70 | putz map("$_ 1o 15m 0o", @edge_rev); 71 | putz map("$_ 1o 15m 0o", @edge_rev); 72 | } 73 | 74 | # Twinkle 75 | for (1..10) { 76 | putz shuffle((map("$_ 1o 8m",@all), map("$_ 0o 8m",@all))); 77 | } 78 | putz map("$_ 0o 8m", shuffle(@all)); 79 | 80 | print getz "_._"; 81 | 82 | } 83 | -------------------------------------------------------------------------------- /projects/demo/test_inputs.pl: -------------------------------------------------------------------------------- 1 | 2 | # Open unbuffered bidirectional serial Teensy connection 3 | open T, '+; $_ =~ s/\r?\n?$//; $_ } 10 | 11 | # Sync up with Txtzyme 12 | putz "_ok_"; $_ = getz until /ok/; 13 | print "running\n"; 14 | 15 | $version = getz "v"; 16 | print "detected $version\n"; 17 | 18 | # Teensy 2.0 19 | if ($version eq 'atmega32u4') { 20 | @top = ('0f','1f','4f','5f','6f','7f','6b','5b','4b','7d','6d'); 21 | @mid_top = ('4d'); 22 | @mid_bot = ('6e','5d'); 23 | @bot = ('0b','1b','2b','3b','7b','0d','1d','2d','3d','6c','7c'); 24 | } 25 | 26 | # Teensy++ 2.0 27 | if ($version eq 'at90usb1286') { 28 | @top = ('6b','5b','4b','3b','2b','1b','0b','7e','6e','0f','1f','2f','3f','4f','5f','6f','7f'); 29 | @mid_top = ('4e','0a','1a','2a','3a'); 30 | @mid_bot = ('5e','4a','5a','6a','7a'); 31 | @bot = ('7b','0d','1d','2d','3d','4d','5d','6d','7d','0e','1e','0c','1c','2c','3c','4c','5c','6c','7c'); 32 | } 33 | 34 | @all = (@top, @mid_top, @mid_bot, @bot); 35 | 36 | # Blink on input logic 1 37 | while (1) { 38 | for (@all) { putz $_, "io{1o}" } 39 | putz "100m"; 40 | for (@all) { putz $_, "io{0o}" } 41 | putz "100m"; 42 | print getz "_._"; 43 | } 44 | -------------------------------------------------------------------------------- /projects/demo/test_outputs.pl: -------------------------------------------------------------------------------- 1 | 2 | # Open unbuffered bidirectional serial Teensy connection 3 | open T, '+; $_ =~ s/\r?\n?$//; $_ } 10 | 11 | # Sync up with Txtzyme 12 | putz "_ok_"; $_ = getz until /ok/; 13 | print "running\n"; 14 | 15 | $version = getz "v"; 16 | print "detected $version\n"; 17 | 18 | # Teensy 2.0 19 | if ($version eq 'atmega32u4') { 20 | @top = ('0f','1f','4f','5f','6f','7f','6b','5b','4b','7d','6d'); 21 | @mid_top = ('4d'); 22 | @mid_bot = ('6e','5d'); 23 | @bot = ('0b','1b','2b','3b','7b','0d','1d','2d','3d','6c','7c'); 24 | } 25 | 26 | # Teensy++ 2.0 27 | if ($version eq 'at90usb1286') { 28 | @top = ('6b','5b','4b','3b','2b','1b','0b','7e','6e','0f','1f','2f','3f','4f','5f','6f','7f'); 29 | @mid_top = ('4e','0a','1a','2a','3a'); 30 | @mid_bot = ('5e','4a','5a','6a','7a'); 31 | @bot = ('7b','0d','1d','2d','3d','4d','5d','6d','7d','0e','1e','0c','1c','2c','3c','4c','5c','6c','7c'); 32 | } 33 | 34 | @all = (@top, @mid_top, @mid_bot, @bot); 35 | 36 | # Quick check, Hi/Lo 37 | for (1..3) { 38 | for (@all) { putz $_, "1o" } 39 | sleep 1; 40 | for (@all) { putz $_, "0o" } 41 | sleep 1; 42 | } 43 | 44 | # Pin by Pin Voice Check 45 | for (@all) { 46 | putz $_, "300m3{1o300m0o300m}"; 47 | `say p, $2, $1.` if /(.)(.)/; 48 | sleep 1; 49 | } 50 | -------------------------------------------------------------------------------- /projects/javascope/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Javascope 3 | ----------------- 4 | by Ward Cunningham 5 | 6 | This java program will read data from a Teensy running Txtzyme and display it as traces in a window. Use p to output data, _label_, to start a new trace. The data can come quickly or slowly. Javascope uses threads to read and display independently. 7 | 8 | Things To Try 9 | ------------- 10 | 11 | Try touching or clipping a short wire to pin F7 to pick up 60Hz hum. 12 | 13 | Compile and launch Javascope. 14 | 15 | $cd projects/javascope 16 | $javac Scope.java 17 | $java Scope & 18 | 19 | Then run one or more shell commands to produce data. 20 | 21 | $ echo _fast_220{5sp} >/dev/cu.usbmodem12341 22 | $ echo _slow_6d1o220{5sp16m600u}0o >/dev/cu.usbmodem12341 23 | $ while sleep .0805; do echo _rep_220{5sp} >/dev/cu.usbmodem12341; done 24 | 25 | Try running Timebase.sh. It makes a good demo because it alternates between slow and fast acquisitions (those with and without 16m600u delay). 26 | 27 | $ sh Timebase.sh -------------------------------------------------------------------------------- /projects/javascope/Timebase.sh: -------------------------------------------------------------------------------- 1 | # alternate between slow and fast acquistion 2 | 3 | echo "Try this to see output:" 4 | echo " javac Scope.java" 5 | echo " java Scope" 6 | 7 | set -e 8 | while true 9 | do echo _slow_6d1o500{11sp16m600u}0o >/dev/cu.usbmodem12341; 10 | sleep 10; 11 | for i in 1 2 3 4 5 6 7 8 9 10 12 | do echo _fast_1o500{11sp}0o >/dev/cu.usbmodem12341 13 | sleep .348 14 | done 15 | done 16 | -------------------------------------------------------------------------------- /projects/matrix/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Matrix 3 | ------------- 4 | by Ward Cunningham 5 | 6 | This project lights an 8x8 LED matrix with various patterns. The NFM-12883 device is insterted into a breadboard socket such that the 16 pins connect to the C and F ports of the Teensy++. Watch the video: 7 | 8 | http://dorkbotpdx.org/blog/wardcunningham/txtzyme_sparkles_on_led_matrix 9 | 10 | 11 | Things to Try 12 | ------------- 13 | 14 | Try various animations. 15 | 16 | $ perl sparkle.pl 17 | 18 | Run the artistic variation, Uno the Integer. 19 | 20 | $ perl uno.pl 21 | 22 | Artist's Statement 23 | ------------------ 24 | 25 | How to describe Uno? He's red. He's fuzzy. He's round, about an inch across and moves several inches a second. We see that he stays about the same size, even when he is partially hidden from view. 26 | 27 | Uno is whole. There is one of him. Counting we find one. He is the integer one. A whole number. Uno. 28 | 29 | Uno asks us to question whole numbers. Although he appears whole, he is whole only in our perception. He is actually a distribution of blinking lights, not a whole anything. 30 | 31 | Neither are we a whole anything. We believe in whole numbers, integers, because we perceive ourselves as whole. If there are three of us in a room then our count equals 3, not 3.0001 or 2.9999. But what are we counting? Only in our perception is any of us whole; any of us an integer. -------------------------------------------------------------------------------- /projects/matrix/arrow.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | 4 | # Teensy 5 | 6 | my $recent = `ls -tr /dev/cu.usbmodem23 | head -1`; 7 | chomp $recent; 8 | print "found $recent\n"; 9 | open T, "+>$recent" or die($!); 10 | select T; $| = 1; 11 | select STDOUT; $| = 1; 12 | 13 | # Txtzyme 14 | 15 | sub putz { local $_; print T map "$_\n", @_ or die($!); } 16 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 17 | 18 | # NFM-12883 19 | 20 | # my @anode = qw( 4c 5f 4f 1c 2f 2c 6c 7c ); # original 21 | # my @cathode = qw( 0c 5c 0f 3c 7f 1f 6f 3f ); 22 | 23 | my @anode = qw( 4f 5c 4c 1f 2c 2f 6f 7f ); # flipped (c for f) 24 | my @cathode = qw( 0f 5f 0c 3f 7c 1c 6c 3c ); 25 | 26 | 27 | sub blink { 28 | my ($x, $y) = (int($_[0]), int($_[1])); 29 | return if $x<0 or $x>7 or $y<0 or $y>7; 30 | my ($a, $c) = ($anode[$x], $cathode[$y]); 31 | putz "6d0o ${a}1o ${c}0o 50u i ${a}i 6d1o"; 32 | } 33 | 34 | sub rn { 35 | rand(2)+rand(2)+rand(2)+rand(2); 36 | } 37 | 38 | my ($x, $y, $xx, $yy) = 0; 39 | my $p = .995; 40 | for (my $t=0; $t<10000000; $t+=1) { 41 | if ($t%3000 == 0) { 42 | ($x, $y) = (int(rn()), int(rn())); 43 | } 44 | ($xx, $yy) = ($xx*$p+$x*(1-$p), $yy*$p+$y*(1-$p)); 45 | blink 46 | $xx+(rn()-4)/1.75, $yy+(rn()-4)/1.75; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /projects/matrix/exhibit/ReadMe.md: -------------------------------------------------------------------------------- 1 | I had planned to exhibit uno in the dorkbot gallery show. 2 | I'd been asking around to borrow a plug-computer to run it for the month long event. 3 | Paul Stoffregen suggested I just rewrite my perl in c and run it on the Teensy stand alone. 4 | I thought it would be too much trouble to make it fast enough. 5 | Paul took that as a challenge. 6 | 7 | Paul wrote four versions with progressively more aggressive optimizations. 8 | This took place one evening in the hacker space at the Portland Open-Source Bridge conference. 9 | 10 | * sparkle_ -- direct conversion from perl 11 | * sparkle_fp -- fixed-point table lookup for sine and random 12 | * sparkle_fastest -- open coding port bit set & clear 13 | 14 | This last version was the first to run faster than the perl/txtzyme version. 15 | It has a delayMicroseconds(75) commented out in the run loop. 16 | The exhibited version had this delay which we tuned to match the visual appearance of the txtzyme version. 17 | 18 | A better match might have been achieved with a longer table of random numbers. 19 | The effective sequence could be improved by combining results from cycling two pointers through the table at different rates. 20 | -------------------------------------------------------------------------------- /projects/matrix/exhibit/sparkle_/sparkle_.pde: -------------------------------------------------------------------------------- 1 | void setup() { 2 | 3 | } 4 | 5 | float rn(void) { 6 | long r = random(0, 200000) + random(0, 200000) + 7 | random(0, 200000) + random(0, 200000); 8 | return r * 0.00001; 9 | } 10 | 11 | byte anode[] = {42, 15, 14, 39, 12, 40, 44, 45}; 12 | byte cathode[] = {38, 43, 10, 41, 17, 11, 16, 13}; 13 | 14 | void blink(char x, char y) { 15 | 16 | } 17 | 18 | char x=0, y=0; 19 | 20 | void loop() { 21 | static float t=0; 22 | if (x >= 0 && x <= 7 && y >= 0 && y <= 7) { 23 | digitalWrite(anode[x], HIGH); 24 | pinMode(anode[x], OUTPUT); 25 | digitalWrite(cathode[y], LOW); 26 | pinMode(cathode[y], OUTPUT); 27 | delayMicroseconds(50); 28 | char xold = x; 29 | char yold = y; 30 | pinMode(anode[xold], INPUT); 31 | pinMode(cathode[yold], INPUT); 32 | x = rn() + 3.0 * sin(7.7 * t); 33 | y = rn() + 3.0 * cos(3.1 * t); 34 | } else { 35 | x = rn() + 3.0 * sin(7.7 * t); 36 | y = rn() + 3.0 * cos(3.1 * t); 37 | } 38 | t = t + 0.0002; 39 | } 40 | -------------------------------------------------------------------------------- /projects/matrix/exhibit/sparkle_fp/sparkle_fp.pde: -------------------------------------------------------------------------------- 1 | char sn[128]; 2 | const int nrnd=333; 3 | byte rnd[nrnd]; 4 | void setup() { 5 | //Serial.begin(); 6 | //delay(4000); 7 | for (int i; i<128; i++) { 8 | sn[i] = 96*sin(i*2*3.14159/128); 9 | //Serial.println((int)sn[i]); 10 | } 11 | for (int i; i> 2; 22 | } 23 | 24 | byte anode[] = {42, 15, 14, 39, 12, 40, 44, 45}; 25 | byte cathode[] = {38, 43, 10, 41, 17, 11, 16, 13}; 26 | 27 | char x=0, y=0; 28 | 29 | void loop() { 30 | static unsigned long i1=0, i2=0; 31 | static unsigned int rindex=0; 32 | if (x >= 0 && x <= 7 && y >= 0 && y <= 7) { 33 | digitalWrite(anode[x], HIGH); 34 | pinMode(anode[x], OUTPUT); 35 | digitalWrite(cathode[y], LOW); 36 | pinMode(cathode[y], OUTPUT); 37 | //delayMicroseconds(50); 38 | char xold = x; 39 | char yold = y; 40 | x = (rnd[rindex] + sn[i1>>25]) >> 5; 41 | pinMode(anode[xold], INPUT); 42 | pinMode(cathode[yold], INPUT); 43 | y = (rnd[rindex+1] + sn[((i2>>25)+32)&127]) >> 5; 44 | } else { 45 | x = (rnd[rindex] + sn[i1>>25]) >> 5; 46 | y = (rnd[rindex+1] + sn[((i2>>25)+32)&127]) >> 5; 47 | } 48 | i1 = i1 + 526335; 49 | i2 = i2 + 211913; 50 | rindex = rindex + 1; 51 | if (rindex >= nrnd - 2) rindex = 0; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /projects/matrix/glider.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | 4 | # Teensy 5 | 6 | open T, "+>/dev/cu.usbmodem12341" or die($!); 7 | select T; $| = 1; 8 | select STDOUT; $| = 1; 9 | 10 | # Txtzyme 11 | 12 | sub putz { local $_; print T map "$_\n", @_ or die($!); } 13 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 14 | 15 | # NFM-12883 16 | 17 | my @anode = qw( 4c 5f 4f 1c 2f 2c 6c 7c ); # original 18 | my @cathode = qw( 0c 5c 0f 3c 7f 1f 6f 3f ); 19 | 20 | # my @anode = qw( 4f 5c 4c 1f 2c 2f 6f 7f ); # flipped (c for f) 21 | # my @cathode = qw( 0f 5f 0c 3f 7c 1c 6c 3c ); 22 | 23 | sub blink { 24 | my ($x, $y) = (int($_[0]), int($_[1])); 25 | return if $x<0 or $x>7 or $y<0 or $y>7; 26 | my ($a, $c) = ($anode[$x], $cathode[$y]); 27 | putz "6d0o ${a}1o ${c}0o 50u i ${a}i 6d1o"; 28 | } 29 | 30 | my @g = ( 31 | 0b0100, 0b0010, 0b1110, 0b0000, 32 | 0b0000, 0b1010, 0b0110, 0b0100, 33 | 0b0000, 0b0010, 0b1010, 0b0110, 34 | 0b0000, 0b0100, 0b0011, 0b0110, 35 | ); 36 | 37 | for my $t (0..10) { 38 | for my $p (0..3) { 39 | for (0..100) { 40 | for my $r (0..3) { 41 | my $i = $g[4*$p+$r]; 42 | for my $c (0..3) { 43 | blink ($t+$c)%8, ($t+$r)%8 if $i/(2**$c)%2; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /projects/matrix/little-uno.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | 4 | # Teensy 5 | 6 | my $recent = `ls -tr /dev/cu.usbmodem* | head -1`; 7 | chomp $recent; 8 | print "found $recent\n"; 9 | open T, "+>$recent" or die($!); 10 | select T; $| = 1; 11 | select STDOUT; $| = 1; 12 | 13 | # Txtzyme 14 | 15 | sub putz { local $_; print T map "$_\n", @_ or die($!); } 16 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 17 | 18 | # NFM-12883 19 | 20 | # my @anode = qw( 4c 5f 4f 1c 2f 2c 6c 7c ); # original 21 | # my @cathode = qw( 0c 5c 0f 3c 7f 1f 6f 3f ); 22 | 23 | my @anode = qw( 4f 5c 4c 1f 2c 2f 6f 7f ); # flipped (c for f) 24 | my @cathode = qw( 0f 5f 0c 3f 7c 1c 6c 3c ); 25 | 26 | 27 | sub blink { 28 | my ($x, $y) = (int($_[0]), int($_[1])); 29 | return if $x<0 or $x>7 or $y<0 or $y>7; 30 | my ($a, $c) = ($anode[$x], $cathode[$y]); 31 | putz "6d0o ${a}1o ${c}0o 50u i ${a}i 6d1o"; 32 | } 33 | 34 | sub rn { 35 | rand(2)+rand(2)+rand(2)+rand(2); 36 | } 37 | 38 | my ($x, $y, $xx, $yy) = 0; 39 | my $p = .995; 40 | for (my $t=0; $t<100000; $t+=1) { 41 | if ($t%3000 == 0) { 42 | ($x, $y) = (int(rn()), int(rn())); 43 | } 44 | ($xx, $yy) = ($xx*$p+$x*(1-$p), $yy*$p+$y*(1-$p)); 45 | blink 46 | $xx+(rn()-4)/1.75, $yy+(rn()-4)/1.75; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /projects/matrix/star.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | 4 | # Teensy 5 | 6 | open T, "+>/dev/cu.usbmodem12341" or die($!); 7 | select T; $| = 1; 8 | select STDOUT; $| = 1; 9 | 10 | # Txtzyme 11 | 12 | sub putz { local $_; print T map "$_\n", @_ or die($!); } 13 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 14 | 15 | # NFM-12883 16 | 17 | my @anode = qw( 4c 5f 4f 1c 2f 2c 6c 7c ); # original 18 | my @cathode = qw( 0c 5c 0f 3c 7f 1f 6f 3f ); 19 | 20 | # my @anode = qw( 4f 5c 4c 1f 2c 2f 6f 7f ); # flipped (c for f) 21 | # my @cathode = qw( 0f 5f 0c 3f 7c 1c 6c 3c ); 22 | 23 | sub blink { 24 | my ($x, $y, $i) = @_; 25 | my ($a, $c) = ($anode[$x], $cathode[$y]); 26 | putz "${a}1o ${c}0o ${i}u i${a}i"; 27 | } 28 | 29 | sub box { 30 | my ($x, $y, $i) = @_; 31 | $i = int(($i+1.1)*100); 32 | blink $x, $y, $i; 33 | blink $x+1, $y, $i; 34 | blink $x, $y+1, $i; 35 | blink $x+1, $y+1, $i; 36 | } 37 | 38 | # Control Knob 39 | 40 | my $prev = '00'; 41 | putz "5bi4b1oi6b1oi5b0o"; # b4 -o<---o- b5 -o--->o- b6 shaft encoding 42 | putz "2bi1b1o2b0o"; # b2 -o--->o- b1 push to close 43 | 44 | sub twisted { 45 | my $curr = getz("4bip") . getz("6bip"); 46 | my $delta = 47 | ($prev.$curr) =~ /0010|1011|1101|0100/ ? -1 : 48 | ($prev.$curr) =~ /0001|0111|1110|1000/ ? 1 : 0; 49 | $prev = $curr; 50 | $delta; 51 | } 52 | 53 | sub pushed { 54 | !getz "1bip"; 55 | } 56 | 57 | # Star Throb Application 58 | 59 | my @x = (3,6,5,1,0); 60 | my @y = (0,2,6,6,2); 61 | my @t = (0,0,0,0,0); 62 | my @d = (11,25,27,12,17); 63 | 64 | my $i = my $ii = 0; 65 | 66 | while (1) { 67 | if (pushed) { 68 | $i = ($ii = ($ii + twisted + 20) % 20) / 4; 69 | box $x[$i], $y[$i], 0; 70 | } else { 71 | $d[$i] += twisted; 72 | for my $j (0..4) { 73 | $t[$j] += $d[$j] / 100; 74 | box $x[$j], $y[$j], sin $t[$j]; 75 | } 76 | } 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /projects/matrix/uno.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | 4 | # Teensy 5 | 6 | my $recent = `ls -tr /dev/cu.usbmodem* | head -1`; 7 | chomp $recent; 8 | print "found $recent\n"; 9 | open T, "+>$recent" or die($!); 10 | select T; $| = 1; 11 | select STDOUT; $| = 1; 12 | 13 | # Txtzyme 14 | 15 | sub putz { local $_; print T map "$_\n", @_ or die($!); } 16 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 17 | 18 | # NFM-12883 19 | 20 | my @anode = qw( 4c 5f 4f 1c 2f 2c 6c 7c ); # original 21 | my @cathode = qw( 0c 5c 0f 3c 7f 1f 6f 3f ); 22 | 23 | # my @anode = qw( 4f 5c 4c 1f 2c 2f 6f 7f ); # flipped (c for f) 24 | # my @cathode = qw( 0f 5f 0c 3f 7c 1c 6c 3c ); 25 | 26 | 27 | sub blink { 28 | my ($x, $y) = (int($_[0]), int($_[1])); 29 | return if $x<0 or $x>7 or $y<0 or $y>7; 30 | my ($a, $c) = ($anode[$x], $cathode[$y]); 31 | putz "6d0o ${a}1o ${c}0o 50u i ${a}i 6d1o"; 32 | } 33 | 34 | sub rn { 35 | rand(2)+rand(2)+rand(2)+rand(2); 36 | } 37 | 38 | for (my $t=0; ; $t+=.0002) { 39 | blink 40 | rn() + 3*sin(7.7*$t), 41 | rn() + 3*cos(3.1*$t); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /projects/matrix/uno.rtfd/IMG_0388.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/matrix/uno.rtfd/IMG_0388.jpg -------------------------------------------------------------------------------- /projects/matrix/uno.rtfd/TXT.rtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/matrix/uno.rtfd/TXT.rtf -------------------------------------------------------------------------------- /projects/moodlites/ReadMe.md: -------------------------------------------------------------------------------- 1 | This project uses Txtzyme to control GE G35 digital LED Holliday lights. 2 | We replace the stock controller with our own code. 3 | Our work follows the protocol described here: 4 | 5 | * http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 6 | 7 | On power-up the lights are dark and the logic at each bulb is waiting to be initialized. 8 | Each new address send finds the next uninitialized light which takes on that address. 9 | We initialize a whole strand by setting each subsequent light to blue: 10 | 11 | * perl enumerate.pl 12 | 13 | We display the mood of our house much the way the classic mood ring displays the mood of the wearer: by temperature. 14 | 15 | * http://en.wikipedia.org/wiki/Mood_ring 16 | 17 | We select one (initialized) bulb at random and then set its color based on some temperature within the house. 18 | We use the furnace's hot-air plenum temperature because the furnace operates in several modes (moods) throughout the day. 19 | 20 | * perl mood.pl 21 | 22 | We use the color code RED=hot, GREEN=warm, BLUE=cold. We observe moods as follows. 23 | 24 | * night: all BLUE due to setback thermostat 25 | * morning: all RED as house is warmed up 26 | * afternoon: all BLUE as outside is warm enough to keep furnace from running 27 | * evening: RED and GREEN as furnace cycles to sustain daytime temperature 28 | 29 | Transitions provide a slowly evolving mixture of the above combinations. 30 | 31 | We've simulated this behavior and found that, for a string of 50 bulbs, updating a single bulb every 15 seconds yields a suitable whole-string response time. 32 | We achieve this period by launching a cron script once every minute. 33 | The script uses sleep to space four invocations of mood.pl 15 seconds apart. 34 | 35 | * * * * * * (cd Txtzyme/projects/moodlites; sh cron.sh) 36 | * 0 0 * * * (cd Txtzyme/projects/moodlines; mv cron.log old.cron.log) 37 | 38 | We've checked for proper operation by computing the distribution of log entries for each of 60 possible seconds. 39 | 40 | If you want to see what you're lights have been doing, there is a log viewer that produces color-coded output from cron.logs with a command something like this. 41 | 42 | * cat old.cron.log cron.log | perl show.pl 43 | 44 | -------------------------------------------------------------------------------- /projects/moodlites/cron.sh: -------------------------------------------------------------------------------- 1 | # * * * * * (cd Txtzyme/projects/moodlites; sh cron.sh) 2 | # 0 0 * * * (cd Txtzyme/projects/moodlites; mv cron.log old.cron.log) 3 | 4 | for i in 1 2 3 4 5 | do perl mood.pl >>cron.log 6 | sleep 10 7 | done 8 | -------------------------------------------------------------------------------- /projects/moodlites/dist.sh: -------------------------------------------------------------------------------- 1 | cat cron.log | perl -e 'for (<>) {$t{$1}++ if /\d+:\d+:(\d+) /} for (0..59) {$t=sprintf("%02d",$_); print "$t\t","|"x$t{$t},"\n"}' 2 | -------------------------------------------------------------------------------- /projects/moodlites/enumerate.pl: -------------------------------------------------------------------------------- 1 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 2 | 3 | sub start { print T "1o" } 4 | sub zero { print T "0o1o2u" } 5 | sub one { print T "0o2u1o" } 6 | sub stop { print T "0o\n" } 7 | 8 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 9 | sub bulb { bits(6, $_[0]) } 10 | sub light { bits(8 ,$_[0]) } 11 | sub color { bits(4, $_[0]) } 12 | 13 | sub set { 14 | my ($bulb, $light, $red, $green, $blue) = @_; 15 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 16 | } 17 | 18 | for (1..50) { set($_, 255, 0, 0, 15) } 19 | -------------------------------------------------------------------------------- /projects/moodlites/mood.pl: -------------------------------------------------------------------------------- 1 | exit; 2 | 3 | # Textzyme 4 | 5 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 6 | 7 | # GE G35 control signals 8 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 9 | 10 | sub start { print T "1o" } 11 | sub zero { print T "0o1o2u" } 12 | sub one { print T "0o2u1o" } 13 | sub stop { print T "0o100m\n" } 14 | 15 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 16 | sub bulb { bits(6, $_[0]) } 17 | sub light { bits(8 ,$_[0]) } 18 | sub color { bits(4, $_[0]) } 19 | 20 | sub set { 21 | my ($bulb, $light, $red, $green, $blue) = @_; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | sub all { 26 | my ($red, $green, $blue) = @_; 27 | for (1..50) { set($_, 255, $red, $green, $blue) } 28 | } 29 | 30 | 31 | # SensorServer json (furnace plenum code c19356) 32 | 33 | `/usr/bin/curl -s guest:please\@jd.local:4567/one/5d` =~ /"c19356":\s*(\d+),/; 34 | my $heat = sprintf("%.1f", ($1/16.0)*9/5+32); 35 | 36 | # Select one bulb and set color based on furnace temperature 37 | 38 | my $bulb = int(rand(50))+1; 39 | 40 | use Fcntl ":flock"; 41 | flock T, LOCK_EX; 42 | 43 | if (-f 'next.txt') { all($c[0], $c[1], $c[2]) if @c = split(/\./, `cat next.txt; rm next.txt`); $show = "next" } 44 | elsif ($heat > 90) { set($bulb, 255, 15, 0, 0); $show = "red"; } 45 | elsif ($heat > 70) { set($bulb, 255, 0, 15, 0); $show = "green"; } 46 | else { set($bulb, 255, 0, 0, 15); $show = "blue"; } 47 | 48 | flock T, LOCK_UN; 49 | 50 | my $now = localtime; 51 | print "$now\t$heat\t$bulb\t$show\n" 52 | -------------------------------------------------------------------------------- /projects/moodlites/perl/colors.pl: -------------------------------------------------------------------------------- 1 | # Random colors applied to random bulbs, every 1/4 second. 2 | 3 | # Textzyme 4 | 5 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 6 | 7 | # GE G35 control signals 8 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 9 | 10 | sub start { print T "1o" } 11 | sub zero { print T "0o1o2u" } 12 | sub one { print T "0o2u1o" } 13 | sub stop { print T "0o\n" } 14 | 15 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 16 | sub bulb { bits(6, $_[0]) } 17 | sub light { bits(8 ,$_[0]) } 18 | sub color { bits(4, $_[0]) } 19 | 20 | sub set { 21 | my ($bulb, $light, $red, $green, $blue) = @_; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | sub all { 26 | my ($red, $green, $blue) = @_; 27 | for (1..50) { set($_, 255, $red, $green, $blue) } 28 | } 29 | 30 | sub rn { 31 | int($_[0]*rand()); 32 | } 33 | 34 | sub br { 35 | return 0 if $_[0]<0.3; 36 | int(15.9*$_[0]); 37 | } 38 | 39 | # see http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV 40 | 41 | sub sat { 42 | ($hue) = @_; 43 | $h = $hue%360/60.0; 44 | $n = int($h); 45 | $f = $h - $n; 46 | ($up,$hi,$dn, $lo) = ($h-$n, .9999, 1-$h+$n, 0); 47 | @r = ($hi, $dn, $lo, $lo, $up, $hi); 48 | @g = ($up, $hi, $hi, $dn, $lo, $lo); 49 | @b = ($lo, $lo, $up, $hi, $hi, $dn); 50 | return (br($r[$n]), br($g[$n]), br($b[$n])) 51 | } 52 | 53 | 54 | while (1) { 55 | ($r, $g, $b) = sat(rn(360)); 56 | set rn(50)+1, 255, $r, $g, $b; 57 | select undef, undef, undef, 0.3; 58 | } 59 | -------------------------------------------------------------------------------- /projects/moodlites/perl/ducks.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 22 | } 23 | 24 | sub all { 25 | my ($red, $green, $blue) = @_; 26 | for (1..50) { set($_, 255, $red, $green, $blue) } 27 | } 28 | 29 | my @snr = (0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,15,15,15); 30 | my @sn = (); 31 | push(@sn, @snr); 32 | push(@sn, reverse(@snr)); 33 | $sn = @sn; 34 | $pn = $sn/2; 35 | 36 | sub sn { 37 | my $n = $_[0]%$sn; 38 | $sn[$n]; 39 | } 40 | 41 | sub fade { 42 | my ($r,$g,$b) = @_; 43 | for $n (1..$sn) { 44 | for (1..50) { 45 | my $pb = $_*3; 46 | set ($_, 255, sn($pb+$n+$pn*$r), sn(15),sn(0)); 47 | } 48 | } 49 | } 50 | 51 | 52 | use Fcntl ":flock"; 53 | flock T, LOCK_EX; 54 | 55 | while(1) { 56 | fade(0,1,2); 57 | } 58 | 59 | flock T, LOCK_UN; 60 | 61 | -------------------------------------------------------------------------------- /projects/moodlites/perl/fade.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 22 | } 23 | 24 | sub all { 25 | my ($red, $green, $blue) = @_; 26 | for (1..50) { set($_, 255, $red, $green, $blue) } 27 | } 28 | 29 | my @snr = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); 30 | my @sn = (); 31 | push(@sn, @snr); 32 | push(@sn, reverse(@snr)); 33 | push(@sn, map(0,@snr)); 34 | $sn = @sn; 35 | $pn = $sn/3; 36 | 37 | sub sn { 38 | my $n = $_[0]%$sn; 39 | $sn[$n]; 40 | } 41 | 42 | sub fade { 43 | my ($r,$g,$b) = @_; 44 | for $n (1..$sn) { 45 | for (1..50) { 46 | my $pb = $_*3; 47 | set ($_, 255, sn($pb+$n+$pn*$r), sn($pb+$n+$pn*$g),sn($pb+$n+$pn*$b)); 48 | } 49 | } 50 | } 51 | 52 | 53 | use Fcntl ":flock"; 54 | flock T, LOCK_EX; 55 | 56 | while(1) { 57 | fade(0,1,2); 58 | } 59 | 60 | flock T, LOCK_UN; 61 | 62 | -------------------------------------------------------------------------------- /projects/moodlites/perl/fall.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 22 | } 23 | 24 | # Performance (Stars and Stripes) 25 | 26 | my $pat = 'yyyyybbbbbbbbyyyyybbbbbyyyybbbbbbbbbbyyyybbbbbyyyybbbbbyyybbbbbbbbbbbbbyyybbbbbyyybbbbb'; 27 | my $rev = ' rrrr ooo oorro ggg '; 28 | my %rgba = ( 29 | 'y' => '15,10,0,255', 30 | 'r' => '15,0,0,255', 31 | 'o' => '15,13,0,127', 32 | 'b' => '4,2,0,100', 33 | 'g' => '3,15,0,255' 34 | ); 35 | 36 | sub perform { 37 | for my $seq (0..(length($pat)-1)) { 38 | for my $bulb (1..50) { 39 | my $ch = substr($rev, ($seq+(51-$bulb))%length($rev), 1); 40 | $ch = substr($pat, ($seq+$bulb)%length($pat), 1) if $ch eq ' ';; 41 | $rgba{$ch} =~ /(\d+),(\d+),(\d+),(\d+)/; 42 | set ($bulb, $4, $1, $2, $3); 43 | } 44 | # select(undef, undef, undef, 0.1); 45 | } 46 | } 47 | 48 | # Control Loop 49 | 50 | use Fcntl ":flock"; 51 | while(1) { 52 | flock T, LOCK_EX; 53 | perform(); 54 | flock T, LOCK_UN; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /projects/moodlites/perl/glory.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 22 | } 23 | 24 | # Performance (Stars and Stripes) 25 | 26 | my $pat = 'wwwwwrrrrrwwwwwrrrrrwwwwwrrrrrwwwwwrrrrrwwwwwbbbbbwwwbbbbbwwwbbbbbwwwbbbbb'; 27 | my %rgb = ('w' => '15,15,15', 'r' => '15,0,0', 'b' => '0,0,15'); 28 | 29 | sub perform { 30 | for my $seq (0..(length($pat)-1)) { 31 | for my $bulb (1..50) { 32 | my $ch = substr($pat, ($seq+$bulb)%length($pat), 1); 33 | $rgb{$ch} =~ /(\d+),(\d+),(\d+)/; 34 | set ($bulb, 255, $1, $2, $3); 35 | } 36 | } 37 | } 38 | 39 | # Control Loop 40 | 41 | use Fcntl ":flock"; 42 | while(1) { 43 | flock T, LOCK_EX; 44 | perform(); 45 | flock T, LOCK_UN; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /projects/moodlites/perl/meteor.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | return if $bulb > 50 or $bulb < 1; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | # flash a streak of white one way or the other 26 | 27 | sub front { set ($_[0], 255, 15, 15, 15); } 28 | sub back { set ($_[0], 0, 0, 0, 0); } 29 | 30 | sub inbound { for $i (0..60) { front (50-$i); back (60-$i); } } 31 | sub outbound { for $i (0..60) { front ($i); back ($i-10); } } 32 | 33 | use Fcntl ":flock"; 34 | flock T, LOCK_EX; 35 | 36 | $n = int (rand(60)); 37 | inbound() if $n == 0; 38 | outbound() if $n == 1; 39 | 40 | # for some reason the above programs leaves 41 | # the last light sometimes glowing red or blue. 42 | # this logic makes sure it is good 'n out. 43 | # (could it be some buffering issue?) 44 | 45 | for (1..5) { 46 | set(1, 0, 0, 0, 0); 47 | set(50, 0, 0, 0, 0); 48 | } 49 | 50 | flock T, LOCK_UN; 51 | 52 | -------------------------------------------------------------------------------- /projects/moodlites/perl/off.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 22 | } 23 | 24 | sub all { 25 | my ($red, $green, $blue) = @_; 26 | for (1..50) { set($_, 255, $red, $green, $blue) } 27 | } 28 | 29 | 30 | use Fcntl ":flock"; 31 | flock T, LOCK_EX; 32 | 33 | for (1..5) { 34 | all(0,0,0); 35 | } 36 | 37 | flock T, LOCK_UN; 38 | 39 | -------------------------------------------------------------------------------- /projects/moodlites/perl/popcorn.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0] < 0 ? 0 : $_[0] > 255 ? 255 : $_[0] ) } 17 | sub color { bits(4, $_[0] < 0 ? 0 : $_[0] > 15 ? 15: $_[0] ) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | return if $bulb > 50 or $bulb < 1; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | use Fcntl ":flock"; 26 | flock T, LOCK_EX; 27 | 28 | my $cen = int(rand(50)); 29 | my @col = (15, 5, 0); 30 | my $r = 7; 31 | for (0..$r) { 32 | set ($cen+$_, 255, $col[0]-$_, $col[1]-$_, $col[2]-$_); 33 | set ($cen-$_, 255, $col[0]-$_, $col[1]-$_, $col[2]-$_); 34 | } 35 | 36 | for (0..$r) { 37 | set ($cen+$r-$_, 15, 1, 1, 1); 38 | set ($cen-$r+$_, 15, 1, 1, 1); 39 | print T "40m"; 40 | } 41 | 42 | for $l (0..5) { 43 | for (0..30) { 44 | set ($cen+(int(rand(2*$r)-$r)), 15-(3*$l), 1, 1, 1); 45 | } 46 | } 47 | 48 | for (0..$r) { 49 | set ($cen+$r-$_, 255, 0, 0, 0); 50 | set ($cen-$r+$_, 255, 0, 0, 0); 51 | print T "40m"; 52 | } 53 | for (0..5) { 54 | set ($cen, 0, 0, 0, 0); 55 | } 56 | 57 | flock T, LOCK_UN; 58 | -------------------------------------------------------------------------------- /projects/moodlites/perl/rainbow.pl: -------------------------------------------------------------------------------- 1 | # Random colors applied to random bulbs, every 1/4 second. 2 | 3 | # Textzyme 4 | 5 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 6 | 7 | # GE G35 control signals 8 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 9 | 10 | sub start { print T "1o" } 11 | sub zero { print T "0o1o2u" } 12 | sub one { print T "0o2u1o" } 13 | sub stop { print T "0o\n" } 14 | 15 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 16 | sub bulb { bits(6, $_[0]) } 17 | sub light { bits(8 ,$_[0]) } 18 | sub color { bits(4, $_[0]) } 19 | 20 | sub set { 21 | my ($bulb, $light, $red, $green, $blue) = @_; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | sub all { 26 | my ($red, $green, $blue) = @_; 27 | for (1..50) { set($_, 255, $red, $green, $blue) } 28 | } 29 | 30 | sub rn { 31 | int($_[0]*rand()); 32 | } 33 | 34 | sub br { 35 | # return 0 if $_[0]<0.1; 36 | int(15.9*$_[0]) 37 | } 38 | 39 | sub sat { 40 | ($hue) = @_; 41 | $h = $hue%360/60.0; 42 | $n = int($h); 43 | $f = $h - $n; 44 | ($up,$hi,$dn, $lo) = ($h-$n, .9999, 1-$h+$n, 0); 45 | @r = ($hi, $dn, $lo, $lo, $up, $hi); 46 | @g = ($up, $hi, $hi, $dn, $lo, $lo); 47 | @b = ($lo, $lo, $up, $hi, $hi, $dn); 48 | return (br($r[$n]), br($g[$n]), br($b[$n])) 49 | } 50 | 51 | $i = 0; 52 | while(1) { 53 | $i+=5; 54 | for $bulb (1..50) { 55 | ($r, $g, $b) = sat($i + 360/20*$bulb); 56 | set $bulb, 255, $r, $g, $b 57 | } 58 | #select undef, undef, undef, 0.3; 59 | } 60 | -------------------------------------------------------------------------------- /projects/moodlites/perl/string.pl: -------------------------------------------------------------------------------- 1 | use strict; 2 | 3 | # Textzyme 4 | 5 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 6 | 7 | # GE G35 control signals 8 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 9 | 10 | sub start { print T "1o" } 11 | sub zero { print T "0o1o2u" } 12 | sub one { print T "0o2u1o" } 13 | sub stop { print T "0o\n" } 14 | 15 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 16 | sub bulb { bits(6, $_[0]) } 17 | sub light { bits(8 ,$_[0]) } 18 | sub color { bits(4, $_[0]) } 19 | 20 | sub set { 21 | my ($bulb, $light, $red, $green, $blue) = @_; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | sub snooze { 26 | my ($sec) = @_; 27 | select undef, undef, undef, $sec; 28 | } 29 | 30 | sub br { 31 | int(15.9*$_[0]); 32 | } 33 | 34 | sub sat { # see http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV 35 | my ($hue) = @_; 36 | my $h = $hue%360/60.0; 37 | my $n = int($h); 38 | my $f = $h - $n; 39 | my ($up,$hi,$dn, $lo) = ($h-$n, .9999, 1-$h+$n, 0); 40 | my @r = ($hi, $dn, $lo, $lo, $up, $hi); 41 | my @g = ($up, $hi, $hi, $dn, $lo, $lo); 42 | my @b = ($lo, $lo, $up, $hi, $hi, $dn); 43 | return (br($r[$n]), br($g[$n]), br($b[$n])) 44 | } 45 | 46 | 47 | 48 | my @r = 0..49; 49 | my @s=map(rand(),@r); 50 | my @c = split '', ' .+omMmo+.'; 51 | 52 | sub pull { 53 | my ($to, $on) = @_; 54 | ($to - $on) / 3; 55 | } 56 | 57 | sub delta { 58 | my ($r) = @_; 59 | my ($left, $right) = (($r+1)%50, ($r+50-1)%50); 60 | my $pull = pull ($s[$left], $s[$r]) + pull ($s[$right], $s[$r]); 61 | my $noise = (2*rand()-rand())/50; 62 | $pull*1.48 + $noise; 63 | } 64 | 65 | sub roll { 66 | my ($s) = @_; 67 | $s+10 - int($s+10); 68 | } 69 | 70 | sub sim { 71 | my @d = map delta($_), @r; 72 | # print join(" ",@d), "\n\n"; 73 | @s = map roll($s[$_]+$d[$_]), @r; 74 | } 75 | 76 | sub show { 77 | for my $bulb (1..50) { 78 | my ($r,$g,$b) = sat $s[$bulb-1]*360; 79 | set $bulb, 255, $r, $g, $b; 80 | } 81 | } 82 | 83 | for my $t (1..2000) { 84 | #print join(" ",map($c[int(10*$_)],@s)),"\n"; 85 | sim; 86 | sim; 87 | show; 88 | #snooze .2; 89 | } 90 | -------------------------------------------------------------------------------- /projects/moodlites/perl/wipe.pl: -------------------------------------------------------------------------------- 1 | 2 | # Textzyme 3 | 4 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 5 | 6 | # GE G35 control signals 7 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 8 | 9 | sub start { print T "1o" } 10 | sub zero { print T "0o1o2u" } 11 | sub one { print T "0o2u1o" } 12 | sub stop { print T "0o20m\n" } 13 | 14 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 15 | sub bulb { bits(6, $_[0]) } 16 | sub light { bits(8 ,$_[0]) } 17 | sub color { bits(4, $_[0]) } 18 | 19 | sub set { 20 | my ($bulb, $light, $red, $green, $blue) = @_; 21 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 22 | } 23 | 24 | sub all { 25 | my ($red, $green, $blue) = @_; 26 | for (1..50) { set($_, 255, $red, $green, $blue) } 27 | } 28 | 29 | sub rn { 30 | $rn = @rn = (0, 1, 3, 7, 15); 31 | $rn[rand($rn)]; 32 | } 33 | 34 | sub every { 35 | for (1..50) {set($_, 255, rn(),rn(),rn()) } 36 | for (1..50) {set(52-$_, 255, rn(),rn(),rn()) } 37 | } 38 | 39 | 40 | use Fcntl ":flock"; 41 | flock T, LOCK_EX; 42 | 43 | every(); 44 | 45 | flock T, LOCK_UN; 46 | 47 | -------------------------------------------------------------------------------- /projects/moodlites/php/Sites.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/moodlites/php/Sites.tgz -------------------------------------------------------------------------------- /projects/moodlites/php/hdr.pl: -------------------------------------------------------------------------------- 1 | # Textzyme 2 | 3 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 4 | 5 | # GE G35 control signals 6 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 7 | 8 | sub start { print T "1o" } 9 | sub zero { print T "0o1o2u" } 10 | sub one { print T "0o2u1o" } 11 | sub stop { print T "0o\n" } 12 | 13 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 14 | sub bulb { bits(6, $_[0]) } 15 | sub light { bits(8 ,$_[0]) } 16 | sub color { bits(4, $_[0]) } 17 | 18 | sub set { 19 | my ($bulb, $light, $red, $green, $blue) = @_; 20 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 21 | } 22 | 23 | sub max { 24 | my ($max, @vars) = @_; 25 | for (@vars) { 26 | $max = $_ if $_ > $max; 27 | } 28 | return $max; 29 | } 30 | 31 | sub sethdr { 32 | my ($bulb, $red, $green, $blue) = @_; 33 | my $light = max $red, $green, $blue; 34 | return set $bulb, 0, 0, 0, 0 if $light == 0; 35 | my ($r, $g, $b) = map int(255.0/$light*$_/16), ($red, $green, $blue); 36 | set $bulb, $light, $r, $g, $b; 37 | } 38 | 39 | sub rn { 40 | int($_[0]*rand()); 41 | } 42 | 43 | sub sc { 44 | return int($_[0]/16); 45 | } 46 | 47 | while (1) { 48 | $_ =`cat /Users/ward/g35/color`; 49 | ($r, $g, $b) = /(\d+)/g; 50 | for $bulb (1..50) { 51 | if ($bulb/3 % 2) { 52 | set $bulb, 255, sc($r), sc($g), sc($b); 53 | } else { 54 | sethdr $bulb, $r, $g, $b; 55 | } 56 | } 57 | select undef, undef, undef, 0.1; 58 | } 59 | -------------------------------------------------------------------------------- /projects/moodlites/php/normal.pl: -------------------------------------------------------------------------------- 1 | # Random colors applied to random bulbs, every 1/4 second. 2 | 3 | # Textzyme 4 | 5 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 6 | 7 | # GE G35 control signals 8 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 9 | 10 | sub start { print T "1o" } 11 | sub zero { print T "0o1o2u" } 12 | sub one { print T "0o2u1o" } 13 | sub stop { print T "0o\n" } 14 | 15 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 16 | sub bulb { bits(6, $_[0]) } 17 | sub light { bits(8 ,$_[0]) } 18 | sub color { bits(4, $_[0]) } 19 | 20 | sub set { 21 | my ($bulb, $light, $red, $green, $blue) = @_; 22 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 23 | } 24 | 25 | sub rn { 26 | int($_[0]*rand()); 27 | } 28 | 29 | sub br { 30 | return 0 if $_[0]<0.3; 31 | int(15.9*$_[0]); 32 | } 33 | 34 | # see http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV 35 | 36 | sub sat { 37 | my ($hue) = @_; 38 | my $h = $hue%360/60.0; 39 | my $n = int($h); 40 | my $f = $h - $n; 41 | my ($up,$hi,$dn, $lo) = ($h-$n, .9999, 1-$h+$n, 0); 42 | my @r = ($hi, $dn, $lo, $lo, $up, $hi); 43 | my @g = ($up, $hi, $hi, $dn, $lo, $lo); 44 | my @b = ($lo, $lo, $up, $hi, $hi, $dn); 45 | return (br($r[$n]), br($g[$n]), br($b[$n])) 46 | } 47 | 48 | @bulb = 1..50; 49 | 50 | sub shuffle { 51 | for (0..49) { 52 | my $n = rn(50); 53 | ($bulb[$_], $bulb[$n]) = ($bulb[$n], $bulb[$_]); 54 | } 55 | } 56 | 57 | while (1) { 58 | $hue = rn(360); 59 | shuffle(); 60 | $dev = (`cat /Users/ward/g35/program` - 1) * 360 / 5; 61 | for $bulb (@bulb) { 62 | ($r, $g, $b) = sat($hue+rn($dev)); 63 | set $bulb, 255, $r, $g, $b; 64 | # set $bulb, 255, $r, $g, $b; 65 | select undef, undef, undef, 0.05; 66 | } 67 | sleep 5; 68 | } 69 | -------------------------------------------------------------------------------- /projects/moodlites/php/solid.pl: -------------------------------------------------------------------------------- 1 | # Textzyme 2 | 3 | open (T, ">".`ls /dev/cu.usbmodem*`) or die($!); 4 | 5 | # GE G35 control signals 6 | # from http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/ 7 | 8 | sub start { print T "1o" } 9 | sub zero { print T "0o1o2u" } 10 | sub one { print T "0o2u1o" } 11 | sub stop { print T "0o\n" } 12 | 13 | sub bits { my ($n,$v) = @_; for (my $i=$n-1; $i>=0; $i--) { $v>>$i&1 ? one() : zero() }} 14 | sub bulb { bits(6, $_[0]) } 15 | sub light { bits(8 ,$_[0]) } 16 | sub color { bits(4, $_[0]) } 17 | 18 | sub set { 19 | my ($bulb, $light, $red, $green, $blue) = @_; 20 | start(); bulb($bulb); light($light); color($blue); color($green); color($red); stop(); 21 | } 22 | 23 | sub rn { 24 | int($_[0]*rand()); 25 | } 26 | 27 | sub sc { 28 | return int($_[0]/16); 29 | } 30 | 31 | @bulbs = []; 32 | for (1..50) { 33 | push @bulbs, "0,0,0"; 34 | } 35 | 36 | sub writeBulbs { 37 | open B, '>/Users/ward/g35/newBulbs'; 38 | print B @bulbs; 39 | close B; 40 | rename '/Users/ward/g35/newBulbs', '/users/ward/g35/bulbs'; 41 | } 42 | 43 | while (1) { 44 | $_ =`cat /Users/ward/g35/color`; 45 | push @bulbs, $_; 46 | shift @bulbs; 47 | for $bulb (1..50) { 48 | ($r, $g, $b) = $bulbs[51-$bulb] =~ /(\d+)/g; 49 | set $bulb, 255, sc($r), sc($g), sc($b); 50 | } 51 | writeBulbs(); 52 | select undef, undef, undef, 0.1; 53 | } 54 | -------------------------------------------------------------------------------- /projects/moodlites/show.pl: -------------------------------------------------------------------------------- 1 | $| = 1; 2 | $div = $ENV{'DIV'} || 4; 3 | %c = (r => 31, g => 32, b => 34, n => 30); 4 | 5 | for (1..50) { 6 | $b{$_} = " "; 7 | } 8 | 9 | for (<>) { 10 | @_ = split(/\t/, $_); 11 | $n = 51 - $_[2]; 12 | $b{$n} = substr($_[3], 0, 1); 13 | next if ($l++) % $div; 14 | print "$_[0]\t"; 15 | p(); 16 | } 17 | 18 | sub p { 19 | for (1..50) { 20 | print " " if $_ == 16 || $_ == 31; 21 | $b = $b{$_}; 22 | $c = $c{$b}; 23 | print "\033[${c}m$b\033[30m "; 24 | } 25 | print "\n"; 26 | } 27 | -------------------------------------------------------------------------------- /projects/moodlites/sim.pl: -------------------------------------------------------------------------------- 1 | # while true; do perl sim.pl; sleep 15; done 2 | 3 | $bulb = int(rand(50))+1; 4 | $status = `tail -1 sim.log`; 5 | chomp($status); 6 | substr($status, $bulb-1, 1) = int(rand(1.6))? 'o' : '.'; 7 | `echo $status >>sim.log`; 8 | -------------------------------------------------------------------------------- /projects/morse/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Morse 3 | ------------- 4 | by Ward Cunningham 5 | 6 | This perl script generates a series of Txtzyme commands and then sends them to the teency's usb device. 7 | 8 | 9 | Things to Try 10 | ------------- 11 | 12 | Generate and transmit the script. 13 | 14 | $ cd projects/morse 15 | $ perl morse.pl 16 | 17 | Watch the morse code blink in the teensy's LED. 18 | 19 | Connect a speaker to pin D6 to hear the morse code. 20 | 21 | 22 | How it Works 23 | ------------ 24 | 25 | The perl program converts ASCII to Morse Code's dots, dashes and spaces. 26 | The program then converts each of these to a Txtzyme program: 27 | 28 | dot => 25{1mom0o}50m 29 | dash => 75{1mom0o}50m 30 | space => mmm 31 | 32 | Dots are 25 cycles of tone followed by a 50 millisecond pause. 33 | Dashes are three times longer than dots, so their program repeats for 75 cycles. 34 | 35 | These Txtzyme programs reuse numbers for several commands. 36 | 37 | Specifically: 38 | 39 | 1mom0o == 1m 1o 1m 0o 40 | 41 | This generates one cycle of the 500 Hz square wave. 42 | 43 | Also letter and word spaces use: 44 | 45 | mmm == 50m 50m 50m == 150m 46 | 47 | This is works when we know 50 is left over from the previous Morse letter. 48 | 49 | -------------------------------------------------------------------------------- /projects/morse/morse.pl: -------------------------------------------------------------------------------- 1 | 2 | # Start with ASCII Message 3 | 4 | $_ = 'THE QUICK BROWN FOX JUMPED OVER THE LAZY DOGS BACK'; 5 | 6 | # Convert ASCII to Morse Code 7 | 8 | s/A/.- /g; 9 | s/B/-... /g; 10 | s/C/-.-. /g; 11 | s/D/-.. /g; 12 | s/E/. /g; 13 | s/F/..-. /g; 14 | s/G/--. /g; 15 | s/H/.... /g; 16 | s/I/.. /g; 17 | s/J/.--- /g; 18 | s/K/-.- /g; 19 | s/L/.-.. /g; 20 | s/M/-- /g; 21 | s/N/-. /g; 22 | s/O/--- /g; 23 | s/P/.--. /g; 24 | s/Q/--.- /g; 25 | s/R/.-. /g; 26 | s/S/... /g; 27 | s/T/- /g; 28 | s/U/..- /g; 29 | s/V/...- /g; 30 | s/W/.-- /g; 31 | s/X/-..- /g; 32 | s/Y/-.-- /g; 33 | s/Z/--.. /g; 34 | 35 | # Convert Morse Code to Txtzyme 36 | 37 | s/\./25{1mom0o}50m\n/g; 38 | s/\-/75{1mom0o}50m\n/g; 39 | s/ /mmm\n/g; 40 | print; 41 | 42 | # Send Txtzyme to Teensy 43 | 44 | `echo '$_' >/dev/cu.usbmodem12341`; 45 | 46 | -------------------------------------------------------------------------------- /projects/morse/morse.txt: -------------------------------------------------------------------------------- 1 | 75{1mom0o}50m 2 | mmm 3 | 25{1mom0o}50m 4 | 25{1mom0o}50m 5 | 25{1mom0o}50m 6 | 25{1mom0o}50m 7 | mmm 8 | 25{1mom0o}50m 9 | mmm 10 | mmm 11 | 75{1mom0o}50m 12 | 75{1mom0o}50m 13 | 25{1mom0o}50m 14 | 75{1mom0o}50m 15 | mmm 16 | 25{1mom0o}50m 17 | 25{1mom0o}50m 18 | 75{1mom0o}50m 19 | mmm 20 | 25{1mom0o}50m 21 | 25{1mom0o}50m 22 | mmm 23 | 75{1mom0o}50m 24 | 25{1mom0o}50m 25 | 75{1mom0o}50m 26 | 25{1mom0o}50m 27 | mmm 28 | 75{1mom0o}50m 29 | 25{1mom0o}50m 30 | 75{1mom0o}50m 31 | mmm 32 | mmm 33 | 75{1mom0o}50m 34 | 25{1mom0o}50m 35 | 25{1mom0o}50m 36 | 25{1mom0o}50m 37 | mmm 38 | 25{1mom0o}50m 39 | 75{1mom0o}50m 40 | 25{1mom0o}50m 41 | mmm 42 | 75{1mom0o}50m 43 | 75{1mom0o}50m 44 | 75{1mom0o}50m 45 | mmm 46 | 25{1mom0o}50m 47 | 75{1mom0o}50m 48 | 75{1mom0o}50m 49 | mmm 50 | 75{1mom0o}50m 51 | 25{1mom0o}50m 52 | mmm 53 | mmm 54 | 25{1mom0o}50m 55 | 25{1mom0o}50m 56 | 75{1mom0o}50m 57 | 25{1mom0o}50m 58 | mmm 59 | 75{1mom0o}50m 60 | 75{1mom0o}50m 61 | 75{1mom0o}50m 62 | mmm 63 | 75{1mom0o}50m 64 | 25{1mom0o}50m 65 | 25{1mom0o}50m 66 | 75{1mom0o}50m 67 | mmm 68 | mmm 69 | 25{1mom0o}50m 70 | 75{1mom0o}50m 71 | 75{1mom0o}50m 72 | 75{1mom0o}50m 73 | mmm 74 | 25{1mom0o}50m 75 | 25{1mom0o}50m 76 | 75{1mom0o}50m 77 | mmm 78 | 75{1mom0o}50m 79 | 75{1mom0o}50m 80 | mmm 81 | 25{1mom0o}50m 82 | 75{1mom0o}50m 83 | 75{1mom0o}50m 84 | 25{1mom0o}50m 85 | mmm 86 | 25{1mom0o}50m 87 | mmm 88 | 75{1mom0o}50m 89 | 25{1mom0o}50m 90 | 25{1mom0o}50m 91 | mmm 92 | mmm 93 | 75{1mom0o}50m 94 | 75{1mom0o}50m 95 | 75{1mom0o}50m 96 | mmm 97 | 25{1mom0o}50m 98 | 25{1mom0o}50m 99 | 25{1mom0o}50m 100 | 75{1mom0o}50m 101 | mmm 102 | 25{1mom0o}50m 103 | mmm 104 | 25{1mom0o}50m 105 | 75{1mom0o}50m 106 | 25{1mom0o}50m 107 | mmm 108 | mmm 109 | 75{1mom0o}50m 110 | mmm 111 | 25{1mom0o}50m 112 | 25{1mom0o}50m 113 | 25{1mom0o}50m 114 | 25{1mom0o}50m 115 | mmm 116 | 25{1mom0o}50m 117 | mmm 118 | mmm 119 | 25{1mom0o}50m 120 | 75{1mom0o}50m 121 | 25{1mom0o}50m 122 | 25{1mom0o}50m 123 | mmm 124 | 25{1mom0o}50m 125 | 75{1mom0o}50m 126 | mmm 127 | 75{1mom0o}50m 128 | 75{1mom0o}50m 129 | 25{1mom0o}50m 130 | 25{1mom0o}50m 131 | mmm 132 | 75{1mom0o}50m 133 | 25{1mom0o}50m 134 | 75{1mom0o}50m 135 | 75{1mom0o}50m 136 | mmm 137 | mmm 138 | 75{1mom0o}50m 139 | 25{1mom0o}50m 140 | 25{1mom0o}50m 141 | mmm 142 | 75{1mom0o}50m 143 | 75{1mom0o}50m 144 | 75{1mom0o}50m 145 | mmm 146 | 75{1mom0o}50m 147 | 75{1mom0o}50m 148 | 25{1mom0o}50m 149 | mmm 150 | 25{1mom0o}50m 151 | 25{1mom0o}50m 152 | 25{1mom0o}50m 153 | mmm 154 | mmm 155 | 75{1mom0o}50m 156 | 25{1mom0o}50m 157 | 25{1mom0o}50m 158 | 25{1mom0o}50m 159 | mmm 160 | 25{1mom0o}50m 161 | 75{1mom0o}50m 162 | mmm 163 | 75{1mom0o}50m 164 | 25{1mom0o}50m 165 | 75{1mom0o}50m 166 | 25{1mom0o}50m 167 | mmm 168 | 75{1mom0o}50m 169 | 25{1mom0o}50m 170 | 75{1mom0o}50m 171 | mmm 172 | -------------------------------------------------------------------------------- /projects/onewire/DS18B20.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/onewire/DS18B20.pdf -------------------------------------------------------------------------------- /projects/onewire/TeensyduinoOneWire/examples/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | OneWire library for Arduino 3 | --------------------------- 4 | 5 | Version 2.0 fixes search bugs (thanks to Robin James) and interrupt issues. 6 | http://www.pjrc.com/teensy/td_libs_OneWire.html 7 | 8 | 9 | This is a slightly modified version of the OneWire library originally written by Jim Studt for arduino-0007 and later updated for arduino-0008 by Josh Larios. This new version eliminates the large lookup table that was previously used by the checksum calculation - otherwise it's identical to Josh's version. It was developed under arduino-0010. 10 | 11 | For a general description and links, see 12 | 13 | http://www.arduino.cc/playground/Learning/OneWire 14 | 15 | Jim Studt's original verion of this library is still available at 16 | 17 | http://www.federated.com/~jim/onewire/ 18 | 19 | Josh Larios' version is available at 20 | 21 | http://www.elsewhere.org/onewire/ 22 | 23 | To install this library, you should just have to unzip the archive in the arduino-0010/hardware/libraries directory. It will create a subdirectory 24 | called 'OneWire'. 25 | 26 | Tom Pollard 27 | pollard@alum.mit.edu 28 | May 20, 2008 29 | -------------------------------------------------------------------------------- /projects/onewire/TeensyduinoOneWire/examples/sample/sample.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* DS18S20 Temperature chip i/o */ 4 | 5 | OneWire ds(10); // on pin 10 6 | 7 | void setup(void) { 8 | Serial.begin(9600); 9 | } 10 | 11 | void loop(void) { 12 | byte i; 13 | byte present = 0; 14 | byte data[12]; 15 | byte addr[8]; 16 | 17 | if ( !ds.search(addr)) { 18 | Serial.print("No more addresses.\n"); 19 | ds.reset_search(); 20 | delay(250); 21 | return; 22 | } 23 | 24 | Serial.print("R="); 25 | for( i = 0; i < 8; i++) { 26 | Serial.print(addr[i], HEX); 27 | Serial.print(" "); 28 | } 29 | 30 | if ( OneWire::crc8( addr, 7) != addr[7]) { 31 | Serial.print("CRC is not valid!\n"); 32 | return; 33 | } 34 | 35 | if ( addr[0] != 0x10) { 36 | Serial.print("Device is not a DS18S20 family device.\n"); 37 | return; 38 | } 39 | 40 | // The DallasTemperature library can do all this work for you! 41 | 42 | ds.reset(); 43 | ds.select(addr); 44 | ds.write(0x44,1); // start conversion, with parasite power on at the end 45 | 46 | delay(1000); // maybe 750ms is enough, maybe not 47 | // we might do a ds.depower() here, but the reset will take care of it. 48 | 49 | present = ds.reset(); 50 | ds.select(addr); 51 | ds.write(0xBE); // Read Scratchpad 52 | 53 | Serial.print("P="); 54 | Serial.print(present,HEX); 55 | Serial.print(" "); 56 | for ( i = 0; i < 9; i++) { // we need 9 bytes 57 | data[i] = ds.read(); 58 | Serial.print(data[i], HEX); 59 | Serial.print(" "); 60 | } 61 | Serial.print(" CRC="); 62 | Serial.print( OneWire::crc8( data, 8), HEX); 63 | Serial.println(); 64 | } 65 | -------------------------------------------------------------------------------- /projects/onewire/TeensyduinoOneWire/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For OneWire 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | OneWire KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | reset KEYWORD2 16 | write_bit KEYWORD2 17 | read_bit KEYWORD2 18 | write KEYWORD2 19 | read KEYWORD2 20 | select KEYWORD2 21 | skip KEYWORD2 22 | depower KEYWORD2 23 | reset_search KEYWORD2 24 | search KEYWORD2 25 | crc8 KEYWORD2 26 | crc16 KEYWORD2 27 | 28 | ####################################### 29 | # Instances (KEYWORD2) 30 | ####################################### 31 | 32 | 33 | ####################################### 34 | # Constants (LITERAL1) 35 | ####################################### 36 | -------------------------------------------------------------------------------- /projects/onewire/get.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # while sleep .5; do perl test.pl; done 3 | 4 | use strict; 5 | 6 | # Teensy (Unbuffered) 7 | 8 | open T, "+>/dev/cu.usbmodem12341" or die($!); 9 | select T; $| = 1; 10 | select STDOUT; $| = 1; 11 | 12 | use Fcntl ":flock"; 13 | flock T, LOCK_EX; 14 | 15 | # Txtzyme 16 | 17 | sub putz { local $_; print T map "$_\n", @_ or die($!) } 18 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 19 | putz "_ok_"; $_ = getz until /ok/; 20 | 21 | # Bi-Color LED (between B0, B1) 22 | 23 | sub red { putz "1bo" } 24 | sub grn { putz "0b1o" } 25 | sub off { putz "1b0obo" } 26 | off; 27 | 28 | # One-Wire Protocol (on pin F6, pwr F7, gnd F5) 29 | 30 | my $pin = "5d"; 31 | putz "${pin}1o5f0o"; 32 | sub rst { getz "${pin}0o480ui60uip420u" } 33 | sub wr { putz $_[0] ? "${pin}0oi60u" : "${pin}0o60ui" } 34 | sub w8 { my ($b) = @_; for (0..7) { wr($b&1); $b /= 2; } } 35 | sub rd { getz "${pin}0oiip45u" } 36 | sub r8 { my $b = 0; for (0..7) { $b |= (rd()<<$_) } return $b } 37 | sub r { my $n = 0; for my $i (0..($_[0]-1)) {$b += (r8() << 8*$i)} $b } 38 | 39 | # DS18B20 Thermometer Functions 40 | 41 | sub skip { w8 0xCC } 42 | sub cnvt { w8 0x44 } 43 | sub data { w8 0xBE } 44 | sub rrom { w8 0x33 } 45 | sub srom { w8 0xF0 } 46 | sub match { w8 0x55 } 47 | 48 | # DS18B20 Thermometer Transactions (single device) 49 | 50 | sub all_cnvt { rst; skip; cnvt; putz "750m" } 51 | sub one_cnvt { rst; skip; cnvt; {} until rd } 52 | sub one_data { rst; skip; data; my $c = r8; $c = r(2); $c<2**15 ? $c : $c-2**16; } 53 | 54 | sub temp_c { all_cnvt; 0.0625 * one_data } 55 | sub temp_f { 32 + 1.8 * temp_c } 56 | 57 | # Read specific device 58 | 59 | my @ar = split '', "0001010011001101111011110110010110000000000000000000000000111101"; 60 | 61 | sub get { 62 | rst; match; for (@ar) {wr $_*1} cnvt; {} until rd; 63 | rst; match; for (@ar) {wr $_*1} data; my $c=r(2); $c<2**15 ? $c : $c-2**16; 64 | } 65 | 66 | my $c = (get()+get()+get()+get())/4.0/16.0; 67 | my $f = $c*9/5+32; 68 | print "$f\n"; 69 | -------------------------------------------------------------------------------- /projects/onewire/plot.pl: -------------------------------------------------------------------------------- 1 | $n = 12; 2 | for (<>) { 3 | ($a,$b,$c) = /(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)/m; 4 | $x += $a+$b+$c; 5 | next if ++$i % $n; 6 | $t = $x/($n*3); 7 | printf("%1.2f\t%s\n", $t, "|" x int(($t-57)*20)); 8 | $x = 0; 9 | } 10 | -------------------------------------------------------------------------------- /projects/onewire/record.sh: -------------------------------------------------------------------------------- 1 | while sleep 10 2 | do QUERRY_STRING="pin=7d" perl scan.pl | 3 | perl -e ' 4 | $_ = join "", <>; 5 | print join "\t", map sprintf("%1.1f", $_/16.0*9/5+32), m/:\s+(\d+)/g; 6 | print "\n" 7 | '; 8 | done | tee data.log -------------------------------------------------------------------------------- /projects/onewire/scan.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | 4 | # Teensy (Unbuffered) 5 | 6 | open T, "+>/dev/cu.usbmodem12341" or die($!); 7 | select T; $| = 1; 8 | select STDOUT; $| = 1; 9 | 10 | # Txtzyme 11 | 12 | sub putz { local $_; print T map "$_\n", @_ or die($!) } 13 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 14 | putz "_ok_"; $_ = getz until /ok/; 15 | 16 | # One-Wire Protocol 17 | 18 | my $pin = "7d"; 19 | sub rst { getz "${pin}0o480ui60uip420u" } 20 | sub wr { putz $_[0] ? "${pin}0oi60u" : "${pin}0o60ui" } 21 | sub w8 { my ($b) = @_; for (0..7) { wr($b&1); $b /= 2; } } 22 | sub rd { getz "${pin}0oiip45u" } 23 | sub r8 { my $b = 0; for (0..7) { $b |= (rd()<<$_) } return $b } 24 | sub r { my $n = 0; for my $i (0..($_[0]-1)) {$b += (r8() << 8*$i)} $b } 25 | 26 | # DS18B20 Thermometer Functions 27 | 28 | sub skip { w8 0xCC } 29 | sub cnvt { w8 0x44 } 30 | sub data { w8 0xBE } 31 | sub rrom { w8 0x33 } 32 | sub srom { w8 0xF0 } 33 | sub mrom { w8 0x55 } 34 | 35 | # DS18B20 Thermometer Transactions (single device) 36 | 37 | sub all_cnvt { rst; skip; cnvt; } 38 | sub one_cnvt { rst; skip; cnvt; {} until rd } 39 | sub one_data { rst; skip; data; my $c = r8; $c += 256 * r8 } 40 | 41 | sub temp_c { all_cnvt; 0.0625 * one_data } 42 | sub temp_f { 32 + 1.8 * temp_c } 43 | 44 | 45 | # Application: read temps in SensorServer compatible format 46 | 47 | my @pins = ('7d', '5d', '4d', '3d'); 48 | @pins = ($1) if $ENV{QUERRY_STRING} =~ /\bpin=(\d[abcdef])/; 49 | sub b2d {oct "0b" . reverse @_} 50 | 51 | # start convert on all pins 52 | 53 | for (@pins) { 54 | $pin = $_; 55 | all_cnvt; 56 | } 57 | sleep 1; 58 | 59 | # search for devices on all pins 60 | 61 | print "{\n"; 62 | for (@pins) { 63 | $pin = $_; 64 | print "\"$_\":\t{\n"; 65 | 66 | my @st = (); 67 | do { 68 | 69 | # find next device 70 | 71 | my @at = (); 72 | !rst or die "no devices on $pin"; 73 | srom; 74 | my @nx = (); 75 | while ((scalar @at) < 64) { 76 | my $lo = rd; 77 | my $hi = rd; 78 | my $x = (scalar @st) ? shift @st : $lo; 79 | wr $x; 80 | @nx = (@at,1) if !$x && !$hi; 81 | push @at, $x 82 | } 83 | die("no pullup on $pin") unless b2d @at[0..30]; 84 | @st = @nx; 85 | 86 | # get converted temperature 87 | 88 | my $code = "c" . b2d (@at[8..23]); 89 | rst; 90 | #select device ------------- 91 | mrom; 92 | map wr($_), @at; 93 | #read temp ------------ 94 | data; my $c = r8; $c += 256 * r8; 95 | $c = $c-2**16 if $c>=2**15; 96 | my $sep = @st ? ',' : ''; 97 | print "\t\"$code\": $c$sep\n"; 98 | 99 | } while(@st); 100 | my $sep = $pin != $pins[-1] ? ',' : ''; 101 | print "}$sep\n"; 102 | } 103 | print "}\n"; 104 | 105 | -------------------------------------------------------------------------------- /projects/onewire/test.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # while sleep .5; do perl test.pl; done 3 | 4 | use strict; 5 | 6 | # Teensy (Unbuffered) 7 | 8 | open T, "+>/dev/cu.usbmodem12341" or die($!); 9 | select T; $| = 1; 10 | select STDOUT; $| = 1; 11 | 12 | use Fcntl ":flock"; 13 | flock T, LOCK_EX; 14 | 15 | # Txtzyme 16 | 17 | sub putz { local $_; print T map "$_\n", @_ or die($!) } 18 | sub getz { local $_; putz @_; $_ = ; $_ =~ s/\r?\n?$//; $_ } 19 | putz "_ok_"; $_ = getz until /ok/; 20 | 21 | # Bi-Color LED (between B0, B1) 22 | 23 | sub red { putz "1bo" } 24 | sub grn { putz "0b1o" } 25 | sub off { putz "1b0obo" } 26 | off; 27 | 28 | # One-Wire Protocol (on pin F6, pwr F7, gnd F5) 29 | 30 | my $pin = "5d"; 31 | putz "${pin}1o5f0o"; 32 | sub rst { getz "${pin}0o480ui60uip420u" } 33 | sub wr { putz $_[0] ? "${pin}0oi60u" : "${pin}0o60ui" } 34 | sub w8 { my ($b) = @_; for (0..7) { wr($b&1); $b /= 2; } } 35 | sub rd { getz "${pin}0oiip45u" } 36 | sub r8 { my $b = 0; for (0..7) { $b |= (rd()<<$_) } return $b } 37 | sub r { my $n = 0; for my $i (0..($_[0]-1)) {$b += (r8() << 8*$i)} $b } 38 | 39 | # DS18B20 Thermometer Functions 40 | 41 | sub skip { w8 0xCC } 42 | sub cnvt { w8 0x44 } 43 | sub data { w8 0xBE } 44 | sub rrom { w8 0x33 } 45 | sub srom { w8 0xF0 } 46 | sub match { w8 0x55 } 47 | 48 | # DS18B20 Thermometer Transactions (single device) 49 | 50 | sub all_cnvt { rst; skip; cnvt; putz "750m" } 51 | sub one_cnvt { rst; skip; cnvt; {} until rd } 52 | sub one_data { rst; skip; data; my $c = r8; $c += 256 * r8 } 53 | 54 | sub temp_c { all_cnvt; 0.0625 * one_data } 55 | sub temp_f { 32 + 1.8 * temp_c } 56 | 57 | # ROM Search 58 | 59 | my @st = (); 60 | do { 61 | my @at = (); 62 | my @pr = (); 63 | print "reset: ", rst, "\n"; 64 | srom; 65 | my @nx = (); 66 | while ((scalar @at) < 64) { 67 | my $lo = rd; 68 | my $hi = rd; 69 | push @pr, 2*!$hi+!$lo; 70 | my $x = (scalar @st) ? shift @st : $lo; 71 | wr $x; 72 | @nx = (@at,1) if !$x && !$hi; 73 | push @at, $x 74 | } 75 | @st = @nx; 76 | print "pr: ", @pr, "\n"; 77 | print "at: ", @at, "\n"; 78 | print "st: ", @st, "\n"; 79 | print "\n"; 80 | } while(@st); 81 | 82 | # Read ROM for single device 83 | 84 | # rst; 85 | # rrom; 86 | # printf "family: %x\n", r8; 87 | # printf "serial: %x\n", r 6; 88 | # printf "check: %x\n", r8; 89 | 90 | # Search ROM 91 | 92 | # Show rising (red) and falling (green) temps 93 | 94 | # my ($old, $new) = (0, 0); 95 | # while (1) { 96 | # ($old, $new) = ($new, temp_c()); 97 | # printf "%3.5f c\n", $new; 98 | # off; 99 | # red if $new > $old; 100 | # grn if $old > $new; 101 | # } 102 | 103 | 104 | -------------------------------------------------------------------------------- /projects/perlscope/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Perlscope 3 | ----------------- 4 | by Ward Cunningham 5 | 6 | Perlscope is a perl script that copies output from Txtzyme and expands numbers within it to include a bar chart representation. One normally leaves Perlscope running as a background job to collect and plot all Txtzyme output. 7 | 8 | 9 | Things to Try 10 | ------------- 11 | 12 | Launch Perlscope as a detached job. 13 | 14 | $ perl -pe 's/\d+/"$&\t"."|"x($&*.1)/e' < /dev/cu.usbmodem12341 & 15 | 16 | Test this with simple commands that generate predictable output. 17 | 18 | $ echo _hello world_ >/dev/cu.usbmodem12341 19 | $ echo __10p20p30p40p >/dev/cu.usbmodem12341 20 | 21 | Try printing samples of hum picked up by a short wire connected to analog input channel 5 (pin F7) The delay, 16.2 milliseconds, has been chosen to sample hum at nearly adjacent points on successive samples. 22 | 23 | $ echo 400{5sp16m200u} >/dev/cu.usbmodem12341 24 | 25 | A neat trick is to write a loop that clears the screen between repeated data acquistions for a more realtime effect. 26 | 27 | $ while sleep .144; do clear; echo 40{5sp300u} > /dev/cu.usbmodem12341; done 28 | 29 | Use shell job control to kill the detached job or just unplug the teensy. Here is a handy script that does all of the steps in one file. 30 | 31 | $ cd projects/perlscope 32 | $ sh scope.sh 33 | 34 | -------------------------------------------------------------------------------- /projects/perlscope/scope.sh: -------------------------------------------------------------------------------- 1 | # Launches background job to plot output from Txtzyme. 2 | # Runs forground loop sampling at a rate good for 60Hz hum. 3 | 4 | perl -pe 's/\d+/"$&\t"."|"x($&*.1)/e' < /dev/cu.usbmodem12341 & 5 | while sleep .144; do clear; echo 40{5sp300u} > /dev/cu.usbmodem12341; done 6 | -------------------------------------------------------------------------------- /projects/ping/28015-PING-v1.6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/ping/28015-PING-v1.6.pdf -------------------------------------------------------------------------------- /projects/ping/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Ping 3 | ----------------- 4 | by Ward Cunningham 5 | 6 | Parallax makes an ultrasonic distance sensor that it distributes through Radio Shack. The device uses a single signal line for both a trigger signal and a return pulse with duration equal to the sound's travel time. 7 | 8 | 9 | Things To Try 10 | ------------- 11 | 12 | Try watching the sensor's output pulse with Javascope. 13 | 14 | Compile Javascope. 15 | 16 | $ cd projects/javascope 17 | $ javac Scope.java 18 | 19 | Try watching the return pulses, 10 per second. Notice how the width changes as objects move in front of the sensor. 20 | 21 | $ cd projects/ping 22 | $ java ../javascope/Scope 2 23 | $ sh ping.sh 24 | 25 | Try watching the pulse width using the "t" timing command. Here the pulse width is plotted on the vertical axis, where 37000 is the maximum range reported by the device, equal to about 12 feet. 26 | 27 | $ cd projects/ping 28 | $ java ../javascope/Scope 37000 29 | $ sh range.sh 30 | 31 | Try pointing the device at a large stable reflector. The ceiling might work well. Collect repeated measurements of this single distance to asses the noise content in the measurement. 32 | 33 | $ cd projects/ping 34 | $ sh stats.sh 35 | 1 19512 36 | 5 19588 37 | 12 19589 38 | 9 19590 39 | 4 19592 40 | 19 19593 41 | 17 19594 42 | 31 19595 43 | 2 19596 44 | 45 | Use Google to calculate the distance to the ceiling: 46 | 47 | 19595 * 9 / (16 MHz) * (331.5 + 0.6 * 25) m/sec / 2 in feet 48 | 49 | This uses the parallax suggested temperature comphensated speed of sound substituting 25 degrees C. Google responds: 50 | 51 | (((19 595 * 9) / (16 MHz)) * ((331.5 + (0.6 * 25)) * (m / sec))) / 2 = 6.26507213 feet 52 | 53 | Show that, save for one sample, the data varies less than a millimeter: 54 | 55 | (19595 - 19588) * 9 / (16 MHz) * (331.5 + 0.6 * 25) m/sec / 2 in mm = 0.682171875 millimeters 56 | 57 | Addendum 58 | -------- 59 | 60 | Further exploration of the measurement stats indicates multiple peaks, spaced 4 to 5 units appart. This is made more visible by drawing a bar for each sample value, including those with zero counts. This is the sort of results we now get: 61 | 62 | 2 8494 || 63 | 9 8495 ||||||||| 64 | 14 8496 |||||||||||||| 65 | 32 8497 |||||||||||||||||||||||||||||||| 66 | 2 8498 || 67 | 2 8499 || 68 | 46 8500 |||||||||||||||||||||||||||||||||||||||||||||| 69 | 50 8501 |||||||||||||||||||||||||||||||||||||||||||||||||| 70 | 98 8502 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 71 | 11 8503 ||||||||||| 72 | 1 8504 | 73 | 4 8505 |||| 74 | 8 8506 |||||||| 75 | 11 8507 ||||||||||| 76 | 1 8508 | 77 | 78 | We don't see multiple peaks when we point the sensor into empty space and let it return the maximal pulse. This indicates the multiple peaks are an artifact of the sensor, not our timing measurement. 79 | 80 | We note that the spacing between these peaks represents a frequency, 1 / (delta period), of around 400 KHz, 10 times the 40KHz chirp frequency of the sensor. -------------------------------------------------------------------------------- /projects/ping/ping.sh: -------------------------------------------------------------------------------- 1 | # view with: java ../javascope/Scope 2 2 | 3 | while sleep .1 4 | do echo _ping_7do0o420{ip10u} >/dev/cu.usbmodem12341 5 | done 6 | -------------------------------------------------------------------------------- /projects/ping/range.sh: -------------------------------------------------------------------------------- 1 | # view with: java ../javascope/Scope 37000 2 | 3 | perl -e ' 4 | while (1) { 5 | print "_range_"; 6 | for (1..300) { 7 | print "7do0otp\n"; 8 | `sleep .1`; 9 | } 10 | } 11 | ' >/dev/cu.usbmodem12341 12 | -------------------------------------------------------------------------------- /projects/ping/stats.sh: -------------------------------------------------------------------------------- 1 | # collect and interpret 100 samples 2 | 3 | perl -e ' 4 | <>; 5 | map $t{int(<>)}++, 2..300; 6 | @k = sort keys %t; 7 | print "\n", map "$t{$_}\t$_\t"."|"x$t{$_}."\n", shift(@k)..pop(@k); 8 | ' < /dev/cu.usbmodem12341& 9 | echo "7do0o300{1o0otp20m}" >/dev/cu.usbmodem12341 10 | 11 | -------------------------------------------------------------------------------- /projects/remote/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Txtzyme Remote 3 | -------------- 4 | by Ward Cunningham 5 | 6 | The Txtzyme Remote server exposes selected Teensy capabilities through an extensible web interface. 7 | 8 | 9 | Things to Try 10 | ------------- 11 | 12 | Upgrade Ruby http://www.ruby-lang.org/en/downloads/ 13 | 14 | $ sudo port install ruby 15 | 16 | Install Ruby modules http://developer.apple.com/tools/developonrailsleopard.html 17 | 18 | $ sudo gem update --system 19 | $ sudo gem install sinatra 20 | $ sudo gem install haml 21 | $ sudo gem install json 22 | 23 | Optionally apply patch for older ruby http://gist.github.com/441238 24 | 25 | Fetch the source http://GitHub/wardcunningham/txtzyme 26 | 27 | $ git clone git@github.com:WardCunningham/Txtzyme.git 28 | 29 | Launch the server. 30 | 31 | $ cd txtzyme/projects/remote 32 | $ rails server.rb 33 | 34 | View individual bits. 35 | 36 | $ curl http://localhost:4567/f/1 37 | 38 | Try the web-form 39 | 40 | http://localhost:4567/ -------------------------------------------------------------------------------- /projects/remote/blink.sh: -------------------------------------------------------------------------------- 1 | while true; do 2 | for i in "1bo 100m o" "1000{0b1o24uo 1bo24uo}" "0b1o 100m o" "1000{0b1o24uo 1bo24uo}" 3 | do echo 5{2b1o6b0o 170u 2b0o6b1o 170u} 2b0oi6b0oi 4 | echo $i 5 | sleep 1 6 | done >/dev/cu.usbmodem12341 7 | done 8 | -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-anim_basic_16x16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-anim_basic_16x16.gif -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_flat_0_eeeeee_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_flat_0_eeeeee_40x100.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_flat_55_c0402a_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_flat_55_c0402a_40x100.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_flat_55_eeeeee_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_flat_55_eeeeee_40x100.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_glass_100_f8f8f8_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_glass_100_f8f8f8_1x400.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_glass_35_dddddd_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_glass_35_dddddd_1x400.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_glass_60_eeeeee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_glass_60_eeeeee_1x400.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_inset-hard_75_999999_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_inset-hard_75_999999_1x100.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-bg_inset-soft_50_c9c9c9_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-bg_inset-soft_50_c9c9c9_1x100.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-icons_3383bb_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-icons_3383bb_256x240.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-icons_70b2e1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-icons_70b2e1_256x240.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-icons_999999_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-icons_999999_256x240.png -------------------------------------------------------------------------------- /projects/remote/public/css/overcast/images/ui-icons_fbc856_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/css/overcast/images/ui-icons_fbc856_256x240.png -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | jQuery UI Authors (http://jqueryui.com/about) 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | and logs, available at http://github.com/jquery/jquery-ui 6 | 7 | Brandon Aaron 8 | Paul Bakaus (paulbakaus.com) 9 | David Bolter 10 | Rich Caloggero 11 | Chi Cheng (cloudream@gmail.com) 12 | Colin Clark (http://colin.atrc.utoronto.ca/) 13 | Michelle D'Souza 14 | Aaron Eisenberger (aaronchi@gmail.com) 15 | Ariel Flesler 16 | Bohdan Ganicky 17 | Scott González 18 | Marc Grabanski (m@marcgrabanski.com) 19 | Klaus Hartl (stilbuero.de) 20 | Scott Jehl 21 | Cody Lindley 22 | Eduardo Lundgren (eduardolundgren@gmail.com) 23 | Todd Parker 24 | John Resig 25 | Patty Toland 26 | Ca-Phun Ung (yelotofu.com) 27 | Keith Wood (kbwood@virginbroadband.com.au) 28 | Maggie Costello Wachs 29 | Richard D. Worth (rdworth.org) 30 | Jörn Zaefferer (bassistance.de) 31 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Paul Bakaus, http://jqueryui.com/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals (AUTHORS.txt, http://jqueryui.com/about) For exact 5 | contribution history, see the revision history and logs, available 6 | at http://jquery-ui.googlecode.com/svn/ 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/calendar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/calendar.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/demo-config-on-tile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/demo-config-on-tile.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/demo-config-on.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/demo-config-on.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/demo-spindown-closed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/demo-spindown-closed.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/demo-spindown-open.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/demo-spindown-open.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/icon-docs-info.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/icon-docs-info.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/jquery_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/jquery_32x32.png -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/jqueryui_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/jqueryui_32x32.png -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/pbar-ani.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/pbar-ani.gif -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/sizzlejs_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/sizzlejs_32x32.png -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/images/transparent_1x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WardCunningham/Txtzyme/a0271ba5d96b6df749f1c58bdd43c32dc98aece5/projects/remote/public/development-bundle/demos/images/transparent_1x1.png -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/colorpicker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Colorpicker 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 35 | 70 | 71 | 72 | 73 |
74 | 75 |

76 | 77 | Simple Colorpicker 78 |

79 | 80 |
81 |
82 |
83 | 84 |
85 | 86 |
87 | 88 |
89 | 90 |

Combine three sliders to create a simple RGB colorpicker.

91 | 92 |
93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Default functionality 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 21 | 22 | 23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 | 32 |

The basic slider is horizontal and has a single handle that can be moved with the mouse or by using the arrow keys.

33 | 34 |
35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/hotelrooms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Range with fixed minimum 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 33 | 34 | 35 | 36 |
37 | 38 |
39 | 40 | 48 |
49 | 50 |
51 | 52 |
53 | 54 |

How to bind a slider to an existing select element. The select stays visible to display the change. When the select is changed, the slider is updated, too.

55 | 56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider Demos 6 | 7 | 8 | 9 | 10 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/multiple-vertical.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Multiple sliders 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 41 | 42 | 43 | 44 |
45 | 46 |

47 | 48 | Master volume 49 |

50 | 51 |
52 | 53 |

54 | 55 | Graphic EQ 56 |

57 | 58 |
59 | 88 60 | 77 61 | 55 62 | 33 63 | 40 64 | 45 65 | 70 66 |
67 | 68 |
69 | 70 |
71 | 72 |

Combine horizontal and vertical sliders, each with their own options, to create the UI for a music player.

73 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/range-vertical.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Vertical range slider 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 29 | 30 | 31 | 32 |
33 | 34 |

35 | 36 | 37 |

38 | 39 |
40 | 41 |
42 | 43 |
44 | 45 |

Change the orientation of the range slider to vertical. Assign a height value via .height() or by setting the height through CSS, and set the orientation option to "vertical."

46 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/range.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Range slider 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 30 | 31 | 32 | 33 |
34 | 35 |

36 | 37 | 38 |

39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |

Set the range option to true to capture a range of values with two drag handles. The space between the handles is filled with a different background color to indicate those values are selected.

47 | 48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/rangemax.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Range with fixed maximum 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 30 | 31 | 32 | 33 |
34 | 35 |

36 | Minimum number of bedrooms: 37 | 38 |

39 |
40 | 41 |
42 | 43 |
44 | 45 |

Fix the maximum value of the range slider so that the user can only select a minimum. Set the range option to "max."

46 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/rangemin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Range with fixed minimum 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 30 | 31 | 32 | 33 |
34 | 35 |

36 | 37 | 38 |

39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |

Fix the minimum value of the range slider so that the user can only select a maximum. Set the range option to "min."

47 | 48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/slider-vertical.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Vertical slider 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 31 | 32 | 33 | 34 |
35 | 36 |

37 | 38 | 39 |

40 | 41 |
42 | 43 |
44 | 45 |
46 | 47 |

Change the orientation of the slider to vertical. Assign a height value via .height() or by setting the height through CSS, and set the orientation option to "vertical."

48 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/demos/slider/steps.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Slider - Snap to increments 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 30 | 31 | 32 | 33 |
34 | 35 |

36 | 37 | 38 |

39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |

Increment slider values with the step option set to an integer, commonly a dividend of the slider's maximum value. The default increment is 1.

47 | 48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /projects/remote/public/development-bundle/external/jquery.bgiframe-2.1.1.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) 2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 4 | * 5 | * $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $ 6 | * $Rev: 2447 $ 7 | * 8 | * Version 2.1.1 9 | */ 10 | (function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='