//In Cerebot2, 4 LEDs (LD1, LD2, LD3, and LD4) are connected to PORTE which are named "user LEDs". //This program Toggles user LEDs (PORTE) in AVR C Language. //Use AVR Studio IDE and WinAVR to make the hex file. //For more information see www.microdigitaled.com and www.digilentinc.com #include #define F_CPU 8000000L //In Cerebot2 XTAL = 8 MHz #include //This file provides delay functions int main () { DDRE = 0xF0; //User LEDs are outputs while (1) { PORTE = 0x50; //PORTE = 0101 0000 B (LD1 = ON, LD2 = OFF, LD3 = ON, LD4 = OFF) _delay_ms(1000); //wait 1 second PORTE = 0xA0; //PORTE = 1010 0000 B (LD1 = OFF, LD2 = ON, LD3 = OFF, LD4 = ON) _delay_ms(1000); //wait 1 second } }