Skip to content

Instantly share code, notes, and snippets.

@FredrikL FredrikL/Wheels.cs
Created Mar 6, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.