/* Demo of the simplest on/off button code for Tiny44 Button connected to PA5 (physical pin 8 on tiny44) Red LED connected to PB2 (physical pin 5 of tiny44) For details on the use of the registers PORtx, DDRx, and PINx (where x = A or B) see tutorials on AVR programming. This program was written by Robert Hart as a simple demonstration of programming AVR microcontrollers. */ // ------- Preamble -------- // #include int main(void) { // -------- Inits --------- // //PORTA = 0b00100000; /* initialize pullup resistor on our input pin by setting bit 5 of register PORTA high. */ DDRA = 0b10000000; /* set up pin 2 of port B for output by setting bit 2 of register DDRB high.*/ // ------ Event loop ------ // while (1) { if ((PINB & 0b00000100) == 0 ) { //look for a button push on PB2// PORTA = 0b10000000; //if button is pushed, send a signal to wifi module TX via PA3 to open webpage// } if ((PINB & 0b00000100) == 0 ) { //look for a signal from FTDI via PA0// PORTA = 0b10000000; //if signal is sent, send signal to wifi module TX via PA3 to open webpage// } if ((PINB & 0b00000100) == 0 ) { //look for a signal from WIFI RX via PA2// PORTA = 0b10000000; //if signal is received, send signal to FTDI via PA0 // } else { /* otherwise */ PORTA = 0b00000000; /* leave output low. */ } } /* End event loop */ return (0); }