Stefan Simbürger
/
PPM_Decoder2
Finished Decoder
main.cpp
- Committer:
- Ursukar
- Date:
- 2020-10-15
- Revision:
- 2:6b9833ee0cc6
- Parent:
- 1:da51d068920b
- Child:
- 3:d22eedba5563
File content as of revision 2:6b9833ee0cc6:
#include "mbed.h" InterruptIn signal(A0); Timer t_Receiver_Ch_Signal; unsigned short all_Ch[8]; unsigned short current_Ch; unsigned char state_Of_Signal; void isrFall() { current_Ch = t_Receiver_Ch_Signal.read_us(); t_Receiver_Ch_Signal.reset(); if(current_Ch >= 6000) { state_Of_Signal = 0; } else if(current_Ch <= 1000) { return; } else{ all_Ch[state_Of_Signal] = current_Ch; state_Of_Signal++; } } int main() { t_Receiver_Ch_Signal.reset(); t_Receiver_Ch_Signal.start(); signal.fall(&isrFall); state_Of_Signal = 0; while (1) { for(int i = 0; i < 8; i++) { printf("Channel %d: %d \n", i + 1, all_Ch[i]); } printf("End of Signal\n"); wait_ms(2000); } return 0; }