Servo controll
Navigates to RoboticsConnection.com Home RoboticsConnection.com HomePage
RoboticsConnection User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Servo controll Expand / Collapse
Author
Message
Posted Saturday, April 12, 2008 2:53 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Saturday, May 10, 2008 2:44 AM
Posts: 13, Visits: 22
Hi in the moment I can make a simple Programm in which i can show the state of the Digital Pins, controll the LEDs and two Motors.

Now I have added a Servo on Servo Pin1. In the timer, where I controll a Motor with the Digital Pin1, I have added the Position argument for the Servo.

When I Start the Programm, the Servo goes first time to the positon. After this the Servo don´t work. At the same time I can´t controll the Motor with my Button.

When I delete the Servo.Position = 40; in my Programm, I can controll the Motor.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Threading;

using RoboticsConnection.Serializer;

using RoboticsConnection.Serializer.Components;

using RoboticsConnection.Serializer.Controllers;

using RoboticsConnection.Serializer.Ids;

using RoboticsConnection.Serializer.Sensors;

namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

private Serializer _s;

private PwmDCMotorController _motor;

private ServoMotorController _servo;

private GpioPin _pin;

public Form1()

{

InitializeComponent();

_s = new Serializer();

_s.PortName = "COM40";

_s.BaudRate = 19200;

_s.CommunicationStarted +=new SerializerEventHandler(_s_CommunicationStarted);

_motor = new PwmDCMotorController(_s);

_motor.DCMotorId = DCMotorId.DCMotor1;

_motor.Speed = 0;

_pin = new GpioPin(_s);

_pin.Pin = GpioPinId.Pin1;

_pin.Enabled = true;

_servo = new ServoMotorController(_s);

_servo.ServoMotorId = ServoMotorId.ServoMotor1;

// _servo.Position = 0;

_s.StartCommunication();

}

void _s_CommunicationStarted(Serializer sender)

{

timer1.Enabled = true;

}

private void timer1_Tick(object sender, EventArgs e)

{

if (_pin.State == true)

{

_motor.Speed = 80;

_servo.Position = 50;

}

if (_pin.State == false)

{

_motor.Speed =0;

_servo.Position = -50;

}

_s.PumpEvents();

}

}

}

Post #334
Posted Sunday, April 13, 2008 7:26 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Monday, October 06, 2008 6:22 AM
Posts: 277, Visits: 407
Hey SilverMatrix,

Hmmm, your app looks correct at first glance...Could you please zip up and send me the solution.  It would be easier for me to find out why you're seeing the behavior you're seeing.

I will be able to get to it Tuesday, as we're in the middle of launching a new product right now...

Also, I moved this post form the Serializer Hardware section to the Serializer Software section.

Best Regards!

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #335
Posted Monday, April 14, 2008 8:19 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Saturday, May 10, 2008 2:44 AM
Posts: 13, Visits: 22
Hi

I have attached the C# Programm and a Picture of  the conection. In so moment I practice only with a Motor, a Servo and a butten.

The Motor funktion is Ok. When I press the Button the motor stops.

But when I activate the Servo Controll in the Programm the servo runs first time in the position and after this the Button don´t work any longer.

  Post Attachments 
WindowsFormsApplication1.zip (3 views, 42.72 KB)
IMG048.jpg (1 view, 282.45 KB)

Post #340
Posted Monday, April 14, 2008 10:09 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Monday, October 06, 2008 6:22 AM
Posts: 277, Visits: 407
The solution you sent must be incomplete.  There aren't any buttons on the form (or in the code), nor button event handlers to make it act like you describe.  Was this an older solution?

Best Regards,

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #341
Posted Tuesday, April 15, 2008 9:12 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Saturday, May 10, 2008 2:44 AM
Posts: 13, Visits: 22
Hi this is my testversion. In this there is a Button at Pin1. When i Press the Button the Motor starts.

At the same time the servo should go to position +50. When I stop pressing the Button the motor should stop, and the servo

should go to position -50.

When I inactivate the servo.positon.....  the motor starts and stops. When the servo position ist activatet, the servo runs first time in the Position. The Motor don´t start or stop. After the first move from the servo nothing goes longer.

This is only for testing. In my Programm which show all input and outputs, the programm is without a servo.

Because I hope it´s easier to find the error in a small Programm.

Post #344
Posted Wednesday, April 16, 2008 7:13 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Monday, October 06, 2008 6:22 AM
Posts: 277, Visits: 407
Silvermatrix,

I understand the problem you are trying to resolve...I just need your latest solution so I can look at it.  The solution you posted doesn't have the button in it, so it must be old.   I didn't see a new solution in your last post either.

I'll get a working solution posted tomorrow for you to use.

Best Regards!

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #353
Posted Tuesday, April 22, 2008 10:20 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Saturday, May 10, 2008 2:44 AM
Posts: 13, Visits: 22
Hi I have now a Programm thas works. There is only one thing.

The Programm is slow. The Action of the switch on the board, or Pressing a Button from the

keyboard works with some time lag. sometimes the start from the Motor has a time lag of 2 -3 seconds.

The Button in the Programm starts the Motor, The switch on Pin1 set the Servo on ServoPin1 to Servopositon 0;

    Pressing 'd' servoposition +2

    Pressing 'a' servoposition -2

it would be super when someone have a little Programm for me, to so what I make wrong.

  Post Attachments 
WindowsApplication2.rar (3 views, 35.21 KB)

Post #404