![RobotStudio event](https://new.abb.com/images/librariesprovider89/default-album/robotstudio-webinar-arc-welding.jpg)
Controlling robot IO with Robot Web Services
![gbdalar](https://secure.gravatar.com/avatar/458b971a823e1a6e48bffc35f0834bb0/?default=https%3A%2F%2Fus.v-cdn.net%2F5020483%2Fuploads%2Fdefaultavatar%2FK2266OAKOLNC.jpg&rating=g&size=200)
I am trying to get my head around using Robot Web Services. I have created a c# client application which can read a robot signal, this all seems to be fine, but I am now trying to understand how to set the signal from the application. There does not seem to be any examples on how this is done in c# in the documentation, I have done it using a html page but can not seem to work out how it is done in c#. Any one who could send me an c# example of how this is done would be great and very much appreciated.
Comments
-
Hi
This method works fine for me
HttpWebResponse ChangeIoSignalValue(string url, string prevvalue)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url + "?action=set"));
request.Credentials = _credentials;
request.Proxy = null;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.CookieContainer = _cookies;string body = null;
if (prevvalue == "1")
{
body = "lvalue=0";
}
else
{
body = "lvalue=1";
}// write to the http stream object
Stream s = request.GetRequestStream();
s.Write(Encoding.UTF8.GetBytes(body), 0, body.Length);
s.Close();HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return response;
}using (HttpWebResponse response = ChangeIoSignalValue(signalUrl, oldIOValue))
{}
0
Categories
- All Categories
- 5.5K RobotStudio
- 397 UpFeed
- 18 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 319 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 804 RAPID Programming
- 4 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings