#13 Add device to project

Unlicense
nobody
None
2020-02-08
2020-02-08
Ingo
No
devId = None
    devices = device_repository.get_all_devices("CODESYS Control Win V3")
    for device in devices:
        devId = device.device_id
    proj = projects.primary

    # delete existing testdev device
    existing = proj.find('testdev')
    if len(existing) > 0:
        existing[0].remove()

    # add device
    proj.add('testdev', devId)
    apps = proj.find('Application', True)
    if len(apps) > 0:
        app = apps[0]
        tc = app.create_task_configuration()

Discussion


Log in to post a comment.