RAPID, Analog Input conversion into a Number
octopus
✭
in RobotStudio
Hello Everybody, here's the question I'd like to solve:
- In a RC5 controller, I have an Analog Input signal (ai1) correclty configured (i.e. if i write "WaitAI ai1, \GT, 5;" and I point with the mouse in RobotStudio on the "ai1" name, I can see the values changing correctly)
- BUT i cannot figure out how to assign these values to a variable (i.e. a VAR num variable), since it is impossible to write something like
VAR num ai_num;
ai_num := ai1;
or
TPWrite "my input signal now has this value: "\num:=ai1;
So, how can I assign an analog input value to a variable (and use that variable in TPwrite or somewhere in the program) ?
Have I to use complex switchcases and the ISignalAI command ?
Thanks a lot to everyone who will decide to help me with this question,
(and sorry if an answer is already existing on the forum, but I did not find it)
All the Best,
Paul
- In a RC5 controller, I have an Analog Input signal (ai1) correclty configured (i.e. if i write "WaitAI ai1, \GT, 5;" and I point with the mouse in RobotStudio on the "ai1" name, I can see the values changing correctly)
- BUT i cannot figure out how to assign these values to a variable (i.e. a VAR num variable), since it is impossible to write something like
VAR num ai_num;
ai_num := ai1;
or
TPWrite "my input signal now has this value: "\num:=ai1;
So, how can I assign an analog input value to a variable (and use that variable in TPwrite or somewhere in the program) ?
Have I to use complex switchcases and the ISignalAI command ?
Thanks a lot to everyone who will decide to help me with this question,
(and sorry if an answer is already existing on the forum, but I did not find it)
All the Best,
Paul
0
Comments
-
Hello
I think you can do this
ai_num := AInput(ai1);
and for TPWrite you need to convert to string ValToStr ( ai_num )
TPWrite "my input signal now has this value: "+ ValToStr ( ai_num );
/Pavel
0 -
Hello Pavel,
worked perfectly, thanks a lot!0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings