Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.SPOT;
- using Microsoft.SPOT.Presentation;
- using Microsoft.SPOT.Presentation.Controls;
- using Microsoft.SPOT.Presentation.Media;
- using Microsoft.SPOT.Hardware;
- using System.Threading;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using GTI = Gadgeteer.Interfaces;
- using Gadgeteer.Modules.GHIElectronics;
- namespace MotorControllerTester
- {
- public partial class Program
- {
- void ProgramStarted()
- {
- /******************************************************************************************
- Access modules defined in the designer by typing their name:
- e.g. button
- camera1
- Initialize event handlers here.
- e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);
- ***************************************************************************************** */
- MotorControllerL298 motorController = new MotorControllerL298(11);
- //for( int i = 0; i < 100; i++ )
- // temp.MoveMotor(MotorControllerL298.Motor.Motor1, i);
- motorController.MoveMotor(MotorControllerL298.Motor.Motor1, 0);
- motorController.MoveMotor(MotorControllerL298.Motor.Motor2, 0);
- #if TRUE
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor1, 100, 5000);
- Debug.Print("going down");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor1, 0, 5000);
- Debug.Print("going moar down");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor1, -100, 5000);
- Debug.Print("going up");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor1, 0, 5000);
- Debug.Print("moar ups");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor1, 100, 5000);
- Debug.Print("OTHER SIDE");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor2, 100, 5000);
- Debug.Print("going down");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor2, 0, 5000);
- Debug.Print("going moar down");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor2, -100, 5000);
- Debug.Print("going up");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor2, 0, 5000);
- Debug.Print("moar ups");
- motorController.MoveMotorRamp(MotorControllerL298.Motor.Motor2, 100, 5000);
- #else
- motorController.MoveMotorRampNB(MotorControllerL298.Motor.Motor1, 100, 5000);
- motorController.MoveMotorRampNB(MotorControllerL298.Motor.Motor1, 100, 5000);
- Thread.Sleep(500);
- motorController.MoveMotorRampNB(MotorControllerL298.Motor.Motor2, -100, 5000);
- #endif
- // Do one-time tasks here
- Debug.Print("Program Started");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement