Ejemplo n.º 1
0
	bool Move() //set movement speed.
	{
		//8=normal (will set default in Tuning.h)
		int actspeed= ILeftSpeed * MAX_DUTY / 16;
		WritePWM(LeftDrive,PERIOD,actspeed);
		actspeed=IRightSpeed * MAX_DUTY / 16;
	}
Ejemplo n.º 2
0
void Led::StopStrobe() {
	isStrobing = false;
	strobe_times_remain = 0;
	isOn = strobe_isOn_before;

	WritePWM();
}
Ejemplo n.º 3
0
void Led::Loop() {
	CalculateFade();
	CalculateStrobe();
	CalculateFadeOnOff();

	WritePWM();
}
Ejemplo n.º 4
0
void Led::SetBrightness(uint8_t brightness) {

	if (IsFading())
		StopFade();

	brightness = constrain(brightness, 0, 255);
	this->brightness = brightness;

	WritePWM();
}
Ejemplo n.º 5
0
void Led::TurnOff() {
	fadeOnOff_current_brightness = 0;
	fadeOnOff_time_remain = 0;

	if (IsStrobing()) {
		strobe_isOn_before = false;
		StopStrobe();
	}
	else
	{
		isOn = false;
		WritePWM();
	}
}
Ejemplo n.º 6
0
//////////////////////////////////////////////////////////////////////////////////
/// name: main
/// params: none
/// return: int
/// desc: calls the initialization of variables/hardware, and contains
///       the main loop with all active functionality
int main(void)
{
    // initialize ports for buttons and LED, PWM receiving, and PWM writing
    intialization();
  
    while ( ! NULL ) 
	{
	    // read in button value (push on, push off)
	    readbutton();
      
	    // read incoming PWM signal for arm extension
	    ReadPWM(PWM_IN_1);

	    // read incoming PWM signal for arm extension
	    // ReadPWM(PWM_IN_2);
      
	    // set the motor state based on PWM frequency
	    InterpretPWM();
      
	    // write to the motor depending on current state
	    WritePWM();
	} 

}