Suga koubou
/
dmx_test
DMX512 library test http://mbed.org/users/okini3939/notebook/dmx512
main.cpp
- Committer:
- okini3939
- Date:
- 2011-06-03
- Revision:
- 3:f8a105b2daf3
- Parent:
- 2:eeb225671cac
- Child:
- 4:4a566dc74bfb
File content as of revision 3:f8a105b2daf3:
#include "mbed.h" #include "DMX.h" //DMX dmx0(p9, p10); DMX dmx1(p13, p14); DMX dmx2(p28, p27); AnalogIn adc(p15); Serial pc(USBTX, USBRX); PwmOut led_r(p22), led_y(p23); int main() { int i, n; // OUTPUT1: fade in / OUTPUT2: fade out while(1) { for (n = 0; n < 256; n ++) { dmx1.put(0, n); dmx2.put(0, 255 - n); led_r = (float)n / 255; led_y = (float)(255 - n) / 255; wait(0.02); } } /* // INPUT1 -> OUTPUT2 / INPUT2 -> OUTPUT1 while (1) { for (i = 0; i < 512; i ++) { n = dmx1.get(i); dmx2.put(i, n); n = dmx2.get(i); dmx1.put(i, n); } led_r = (float)dmx1.get(0) / 255; led_y = (float)dmx2.get(0) / 255; wait(0.1); } */ }