#include #include #include #include "USART.h" /* OBJECTIVE: pulse the infrared transmitter (prefferably with a code of 'clc') at a given rate. if the pulse is recieved, transmit, or pass off, a run command for Python to pickup via serial. */ /* PIN LAYOUT Transmitter on PC5 Reciever on PB0 */ void fireT(){ // fires the transmitter PORTC ^= (1 << PC5); _delay_ms(750); // wait } ISR(INT0_vect) { /* Run every time there is a change on button */ printString("run\n"); fireI(); } void initInterrupt0(void) { EIMSK |= (1 << INT0); /* enable INT0 */ EICRA |= (1 << ISC00); /* trigger when button changes */ sei(); /* set (global) interrupt enable bit */ } void initMCU(void){ // initialize the board setup for proper operation DDRB = 0x00; // Ensures configuration of register B for input DDRC = 0xff; // configures register C for output } void fireI(){ // fires the transmitter PORTC ^= (1 << PC3); _delay_ms(500); // wait } int main(void){ // main function to execute objeective listed above initMCU(); //init initInterrupt0(); initUSART(); while(1){ // test cycle fire function fireT(); } return 0; }