00001 /******************************************************************************* 00002 * 00003 * Description: Asuro IR-Detektor Testprogramm 00004 * 00005 *****************************************************************************/ 00006 /*************************************************************************** 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * any later version. * 00012 ***************************************************************************/ 00013 #include "asuro.h" 00014 #include <stdlib.h> 00015 00016 int main(void) 00017 { 00018 00019 unsigned char sw; 00020 00021 Init(); 00022 DDRD |= (1 << DDD1); // Port D1 als Ausgang 00023 PORTD &= ~(1 << PD1); // PD1 auf LOW 00024 00025 while (1) 00026 { 00027 if (PIND & (1 << PD0)) 00028 StatusLED(GREEN); 00029 else 00030 StatusLED(RED); 00031 00032 sw = PollSwitch(); 00033 if (sw & 0x01) 00034 OCR2 = 0xFE; //Pulsbreite 1 00035 if (sw & 0x02) 00036 OCR2 = 0xFD; //Pulsbreite 2 00037 if (sw & 0x04) 00038 OCR2 = 0xFB; //Pulsbreite 4 00039 if (sw & 0x08) 00040 OCR2 = 0xF7; //Pulsbreite 8 00041 if (sw & 0x10) 00042 OCR2 = 0xEF; //Pulsbreite 16 00043 if (sw & 0x20) 00044 OCR2 = 0x90; //Pulsbreite 110 00045 } 00046 return 0; 00047 }