Skip to content

Instantly share code, notes, and snippets.

@FredrikL
Created March 6, 2012 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FredrikL/1984972 to your computer and use it in GitHub Desktop.
Save FredrikL/1984972 to your computer and use it in GitHub Desktop.
Motors n stuff
public class Wheels : IWheels
{
private readonly OutputPort motorOneDirection;
private readonly OutputPort motorTwoDirection;
private readonly PWM motorOneSpeed;
private readonly PWM motorTwoSpeed;
public Wheels(Cpu.Pin motorOneDirectionPin, Cpu.Pin motorOneSpeedPin,
Cpu.Pin motorTwoDirectionPin, Cpu.Pin motorTwoSpeedPin)
{
this.motorOneDirection = new OutputPort(motorOneDirectionPin, false);
this.motorTwoDirection = new OutputPort(motorTwoDirectionPin, false);
this.motorOneSpeed = new PWM(motorOneSpeedPin);
this.motorTwoSpeed = new PWM(motorTwoSpeedPin);
}
public void Forward()
{
this.motorOneSpeed.SetPulse(10000, 10000);
this.motorTwoSpeed.SetPulse(10000, 10000);
this.motorOneDirection.Write(true);
this.motorTwoDirection.Write(true);
}
public void Reverse()
{
throw new NotImplementedException();
}
public void Left()
{
throw new NotImplementedException();
}
public void Right()
{
throw new NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment