예제 #1
0
int main(void)
{
	OSCCAL = 0xF2;
	
	LEDdrive_on();
	LEDdrive_init();
	TWI_init();
	LED_row_init();
	timer_init();

	double rand_num;
	int i,j;
	while(1)
	{
		for(j=0;j<3;j++)	
		{
			for(i=0;i<81;i++)
			{
				rand_num = (double)((uint16_t)rand()) / 65536;
				update_LED(i,j,rand_num);
			}
		}
		disp_LED(5000);
		LED_clear();
	}	
}
예제 #2
0
int main()
{
    enum state s = STATE_INITIALIZE;
    while (1)
    {
        switch (s)
        {
            case STATE_INITIALIZE:
            init_board();
            s = MAIN;
            break;

            case MAIN:

            update_LED();

            if () {
            }


        }
    }
}
예제 #3
0
// This runs continuously in a loop.
void Controller::loop()
{


	//read from wireless, see if ssd or mode changes
	//if the ssd or mode is different from before,
	//update it

	//	_delay_ms(10000);

	//if button is pressed
	if ((bit_is_clear(PIND,5))){//PD5, the button pin, is pressed
		//check to see if still depressed for 5+ seconds:
		_delay_ms(5000);
		if ((bit_is_clear(PIND,5))){
			//button has been selected for 5+ seconds
			//send reset signal to base station
			update_LED(SYSTEM_SYNC);	//turn led blue

			update_relay(0);
			spin_SSDs();	//spin SSDs

			//after sending sync signal, read ssd values and status from base station
			//update ssds
			//update relay
			//update led to on or off
			update_LED(1);	//turn led green, for debgging, remove this
			update_relay(1);

		}
	}


/*
	//after checking button input, now we can check if receiving wireless
	if (0 == 1){	//read from wireless
		//read status
		//read ssd0
		//read ssd1
		if (read_status != status) {	//updating status of relay
			update_relay(read_status);
			update_LED(read_status);
			status = read_status;
		}
		if (read_ssd0 != ssd0) {
			update_ssd0(read_ssd0);
			ssd0 = read_ssd0;
		}
		if (read_ssd1 != ssd1) {
			update_ssd1(read_ssd1);
			ssd1 = read_ssd1;
		}
	}//end if read from wireless
*/

	_delay_ms(100);

	update_ssd0(9);
	update_ssd1(9);



}