Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net;
- using System.Net.Sockets;
- using System.Threading;
- using Microsoft.SPOT;
- using Microsoft.SPOT.Hardware;
- using SecretLabs.NETMF.Hardware;
- using SecretLabs.NETMF.Hardware.Netduino;
- using Toolbox.NETMF.Hardware;
- namespace Playground
- {
- public class Program
- {
- public static void Main()
- {
- // Defines the HBridge IC on the correct pins
- HBridge MotorDriver = new HBridge(new Netduino.PWM(Pins.GPIO_PIN_D0), Pins.GPIO_PIN_D1, new Netduino.PWM(Pins.GPIO_PIN_D2), Pins.GPIO_PIN_D3);
- while (true)
- {
- // Motor 1 half speed backward
- MotorDriver.SetState(HBridge.Motors.Motor1, -50);
- // Lets run for 5 seconds
- Thread.Sleep(5000);
- // Motor 1 full speed backward
- MotorDriver.SetState(HBridge.Motors.Motor1, -100);
- // Lets run for 5 seconds
- Thread.Sleep(5000);
- // Stops both motors
- MotorDriver.SetState(HBridge.Motors.Motor1, 0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement