read output in VBA
I want to read an output from the active robotcontroller in my vba application in an IF THEN but it won't work.
Regards
Michael
Comments
-
Hi Michael
Here comes 2 different examples how you could do it.
The first one is just a simple read of IO from controller and
the second one reacts on changes on a specific IO.
1.
Sub ReadIO()
Dim mIO As IO
Set mIO = ActiveStation.ActiveMechanism.Controller.IO("doFinish")
If mIO.Value = 1 Then
MsgBox "Value is 1"
Else
MsgBox "Value is 0"
End If
End Sub2.
Dim WithEvents mIO As IO
Sub ConnectIO()
'Run this to start looking for changes
Set mIO = ActiveStation.ActiveMechanism.Controller.IO("doFinish")
End SubPrivate Sub mIO_Change()
'This will execute if there is a value change
If mIO.Value = 1 Then
MsgBox "Value is 1"
Else
MsgBox "Value is 0"
End If
End SubHope this will help you
Regards
Per
Per Svensson
Company Specialist
ABB Automation Technology Products0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings