20from pathlib
import Path
29if platform.system() ==
"Windows":
32 import RapidCodeHelpers
as helpers
33 rapidcode_dir = helpers.find_rapid_code_directory()
34 sys.path.append(rapidcode_dir)
37 os.add_dll_directory(
"c:\\Program Files (x86)\\INtime\\bin")
40 rapidcode_dir =
"/rsi"
41 sys.path.append(rapidcode_dir)
42 sys.path.append(
"/rsi/examples/Python")
43 import RapidCodeHelpers
as helpers
45import RapidCodePython
as RapidCode
50class Testing(unittest.TestCase):
100 def test_iopoint(self):
101 creation_params:RapidCode.CreationParameters = helpers.get_creation_parameters()
102 motioncontroller:RapidCode.MotionController = RapidCode.MotionController.Create(creation_params)
103 helpers.check_errors(motioncontroller)
109 user_buffer_address = motioncontroller.AddressGet(RapidCode.RSIControllerAddressType_RSIControllerAddressTypeUSER_BUFFER, 0)
111 input0 = RapidCode.IOPoint.CreateDigitalInput( motioncontroller, user_buffer_address, INPUT_INDEX)
112 output0 = RapidCode.IOPoint.CreateDigitalOutput( motioncontroller, user_buffer_address, OUTPUT_INDEX)
115 assert not output0.Get(),
"The getter function should return a value equal to false"
117 assert output0.Get(),
"The getter function should return a value equal to true"
118 motioncontroller.MemorySet(input0.AddressGet(), 0)
119 assert not input0.Get(),
"The getter function should return a value equal to false"
120 motioncontroller.MemorySet(input0.AddressGet(), 1)
121 assert input0.Get(),
"The getter function should return a value equal to true"
123 motioncontroller.Delete()
163if __name__ ==
'__main__':