Suga koubou
/
dmx_test
DMX512 library test http://mbed.org/users/okini3939/notebook/dmx512
main.cpp
- Committer:
- okini3939
- Date:
- 2011-05-08
- Revision:
- 2:eeb225671cac
- Parent:
- 0:ac66b38a42e3
- Child:
- 3:f8a105b2daf3
File content as of revision 2:eeb225671cac:
#include "mbed.h" #include "DMX.h" DMX dmx(p9, p10); //DMX dmx(p13, p14); //DMX dmx(p28, p27); AnalogIn adc(p15); PwmOut led[] = {(LED1), (LED2), (LED3), (LED4)}; Serial pc(USBTX, USBRX); int main() { int i, n; while(1) { wait(0.1); n = adc.read_u16() >> 8; dmx.put(0, n); pc.printf("tx: %d / ", n); pc.printf("rx: ", dmx.get(0)); for (i = 0; i < 4; i ++) { n = dmx.get(i); led[i] = (float)n / 255.0; pc.printf("%d ", n); } pc.printf("\r\n"); } }