How can I reset an encoder index value with a button

Supporting Visual Studio on Windows
Ya-Nvr-No
Fresh meat
Posts: 3
Joined: Wed Aug 01, 2012 6:37 am
Contact:

How can I reset an encoder index value with a button

Postby Ya-Nvr-No » Thu Aug 16, 2012 8:45 am

once found It displays the read only variable .
encoder.encodersWithEnable[0].IndexPosition

I would like to be able to reset it to the "unknown" status till it is found again. But once found it shows the last found value until it is found again then it updates the textbox.

private void zeroButton1_Click(object sender, EventArgs e)
{
encoder.encoders[0] = 0;
encoderPositionTxt1.Text = encoder.encoders[0].ToString();
indexPositionTxt1.Text = "Unknown";
// encoder.encodersWithEnable[0].IndexPosition = 0;
}

//Thanks for any assistance.

Ya-Nvr-No
Fresh meat
Posts: 3
Joined: Wed Aug 01, 2012 6:37 am
Contact:

Re: How can I reset an encoder index value with a button

Postby Ya-Nvr-No » Wed Aug 29, 2012 7:24 pm

Still looking for some assistance
Attachments
phidget.JPG
phidget.JPG (76.65 KiB) Viewed 2474 times

Ya-Nvr-No
Fresh meat
Posts: 3
Joined: Wed Aug 01, 2012 6:37 am
Contact:

Re: How can I reset an encoder index value with a button

Postby Ya-Nvr-No » Thu Sep 06, 2012 7:23 pm

// Though it does not reset it I Got it to work this way by setting a flag when the Zero button is pressed:

case Phidget.PhidgetID.ENCODER_HS_4ENCODER:
try
{
if (index_flag2 == 1 && index_pos_txt2 != encoder.encodersWithEnable[1].IndexPosition.ToString())
{
index_flag2 = 0;
}
if (index_flag2 == 0)
{
index_pos_txt2 = encoder.encodersWithEnable[1].IndexPosition.ToString();
indexPositionTxt2.Text = index_pos_txt2;
}
}
catch (PhidgetException)
{
indexPositionTxt2.Text = "Unknown";
}
break;


Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 9 guests