chris stevens
/
IRDATX
tsmp1138 ir led transmitter demo
main.cpp@0:0f4b530d91d5, 2014-05-21 (annotated)
- Committer:
- cstevens
- Date:
- Wed May 21 11:33:57 2014 +0000
- Revision:
- 0:0f4b530d91d5
ir transmitter for tsmp1138;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cstevens | 0:0f4b530d91d5 | 1 | #include "mbed.h" |
cstevens | 0:0f4b530d91d5 | 2 | |
cstevens | 0:0f4b530d91d5 | 3 | DigitalOut myled(LED1); |
cstevens | 0:0f4b530d91d5 | 4 | Serial pc(USBTX,USBRX); |
cstevens | 0:0f4b530d91d5 | 5 | Serial IRTX(PTC4,PTC3); // TX,RX |
cstevens | 0:0f4b530d91d5 | 6 | DigitalOut Ipower(PTC12); // pin to power the irda |
cstevens | 0:0f4b530d91d5 | 7 | |
cstevens | 0:0f4b530d91d5 | 8 | int main() { |
cstevens | 0:0f4b530d91d5 | 9 | // power the irda electronics on |
cstevens | 0:0f4b530d91d5 | 10 | int i=0; |
cstevens | 0:0f4b530d91d5 | 11 | Ipower=1; |
cstevens | 0:0f4b530d91d5 | 12 | for(i=0;i<5;i++){ |
cstevens | 0:0f4b530d91d5 | 13 | myled=0; |
cstevens | 0:0f4b530d91d5 | 14 | pc.printf("Sending %d\n\r",i); |
cstevens | 0:0f4b530d91d5 | 15 | IRTX.printf("Hello IRDA \r"); |
cstevens | 0:0f4b530d91d5 | 16 | myled=1; |
cstevens | 0:0f4b530d91d5 | 17 | wait(0.2); |
cstevens | 0:0f4b530d91d5 | 18 | } |
cstevens | 0:0f4b530d91d5 | 19 | |
cstevens | 0:0f4b530d91d5 | 20 | } |