![](/media/cache/profiles/f095cedd23b99f1696fc8caecbcf257e.jpg.50x50_q85.jpg)
DMX512 library test http://mbed.org/users/okini3939/notebook/dmx512
main.cpp@0:ac66b38a42e3, 2011-05-03 (annotated)
- Committer:
- okini3939
- Date:
- Tue May 03 12:13:42 2011 +0000
- Revision:
- 0:ac66b38a42e3
- Child:
- 2:eeb225671cac
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okini3939 | 0:ac66b38a42e3 | 1 | #include "mbed.h" |
okini3939 | 0:ac66b38a42e3 | 2 | #include "DMX.h" |
okini3939 | 0:ac66b38a42e3 | 3 | |
okini3939 | 0:ac66b38a42e3 | 4 | DMX dmx(p9, p10); |
okini3939 | 0:ac66b38a42e3 | 5 | //DMX dmx(p13, p14); |
okini3939 | 0:ac66b38a42e3 | 6 | //DMX dmx(p28, p27); |
okini3939 | 0:ac66b38a42e3 | 7 | |
okini3939 | 0:ac66b38a42e3 | 8 | DigitalOut myled(LED1); |
okini3939 | 0:ac66b38a42e3 | 9 | Serial pc(USBTX, USBRX); |
okini3939 | 0:ac66b38a42e3 | 10 | |
okini3939 | 0:ac66b38a42e3 | 11 | int main() { |
okini3939 | 0:ac66b38a42e3 | 12 | int i, j; |
okini3939 | 0:ac66b38a42e3 | 13 | |
okini3939 | 0:ac66b38a42e3 | 14 | j = 0; |
okini3939 | 0:ac66b38a42e3 | 15 | while(1) { |
okini3939 | 0:ac66b38a42e3 | 16 | myled = 1; |
okini3939 | 0:ac66b38a42e3 | 17 | wait(0.2); |
okini3939 | 0:ac66b38a42e3 | 18 | myled = 0; |
okini3939 | 0:ac66b38a42e3 | 19 | wait(0.2); |
okini3939 | 0:ac66b38a42e3 | 20 | |
okini3939 | 0:ac66b38a42e3 | 21 | j = j + 10; |
okini3939 | 0:ac66b38a42e3 | 22 | if (j >= 256) j = 0; |
okini3939 | 0:ac66b38a42e3 | 23 | for (i = 0; i < DMX_SIZE; i ++) { |
okini3939 | 0:ac66b38a42e3 | 24 | dmx.put(i, j); |
okini3939 | 0:ac66b38a42e3 | 25 | } |
okini3939 | 0:ac66b38a42e3 | 26 | |
okini3939 | 0:ac66b38a42e3 | 27 | pc.printf("tx: %d\r\n", j); |
okini3939 | 0:ac66b38a42e3 | 28 | |
okini3939 | 0:ac66b38a42e3 | 29 | pc.printf("rx: ", dmx.get(0)); |
okini3939 | 0:ac66b38a42e3 | 30 | for (i = 0; i < 16; i ++) { |
okini3939 | 0:ac66b38a42e3 | 31 | pc.printf("%d ", dmx.get(i)); |
okini3939 | 0:ac66b38a42e3 | 32 | } |
okini3939 | 0:ac66b38a42e3 | 33 | pc.printf("\r\n"); |
okini3939 | 0:ac66b38a42e3 | 34 | } |
okini3939 | 0:ac66b38a42e3 | 35 | } |