//*******************************************************************
// KH31-35 Blink Function                               E215  11 0831
//      15 points
//*******************************************************************
#include "s215-header22-f46-NWDT.h" 
#pragma code
//|||||||||||||||||||||||||||| FUNCTION PROTOTYPES ||||||||||||||||||
void	Blink0(float ontime, float offtime);

//||||||||||||||||||||||||| BEGINNING OF MAIN PROGRAM |||||||||||||||
void main (void)
{
InitPorts();
//----------------------------------
while (1==1)
{
//|||||||||||||||||||||||||||||||| MAIN LOOP ||||||||||||||||||||||||
if (SW0==1) 
	Blink0(25, 100);
else if (SW1==1) 
   	Blink0(100, 25);
else if (SW2==1)
	Blink0(25,25);

/* Put more else-if statements here to make the LED blink as follows:
SW3		ON 100ms, OFF 100ms
SW4		ON 20ms, OFF 20ms
*/

else 
	LEDS = 0;
//||||||||||||||||||||||||||||| END OF MAIN LOOP ||||||||||||||||||||		
}
}
//||||||||||||||||||||||||||| END OF MAIN PROGRAM |||||||||||||||||||
void
Blink0(float ontime, float offtime)
//BLINK LED 0.
//ontime = time LED will be on, in tens of milliseconds.
//offtime =  LED will be OFF, in tens of milliseconds.
{
LED0 = 1;
Delay10ms(ontime);
LED0 = 0;
Delay10ms(offtime);
}