--- title: "How To Include Factory Kit Devices in Apps" slug: "how-to-include-factory-kit-devices-in-apps" updated: 2023-10-31T19:05:45Z published: 2023-10-31T19:05:45Z canonical: "support.tulip.co/how-to-include-factory-kit-devices-in-apps" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # 如何在应用程序中包含出厂套件设备 ## 如何在应用程序中包含工厂套件设备 *了解如何在应用程序中包含 5 种工厂套件设备,包括接收人工输入和根据应用程序中的操作触发设备。* #### Tulip Factory Kit 是 Tulip 新用户开始使用边缘连接的首批配件和硬件套件。 #### **工厂套件已于 2022 年 6 月 23 日停产。** [设置好所有工厂套件设备](/r230/docs/factory-kit-quickstart-guide)后,就可以开始利用设备输入和输出构建应用程序逻辑了。通常,这将在步骤触发器和按钮触发器中进行。 在本示例中,我们将介绍一个指导操作员组装电路板的工作指导应用程序。该应用程序将与 5 个工厂套件设备配合使用: 1. 条形码扫描器 2. 脚踏板 3. 对光拾取 4. 破光束传感器 5. 安灯 在应用程序的每个步骤中,您都将了解现实世界中发生的事情,以及这些事情如何与应用程序中的触发逻辑相联系。 以下是该程序的操作 1. 要求操作员扫描将要装配的部件的条形码 2. 给出一系列工作指令步骤。在某些步骤中,操作员必须从特定的料仓中抓取部件。 3. 要求操作员在完成之前检查部件 4. 如果零件通过检查,则该程序完成。 5. 如果零件未通过检查,则会呼叫质量专家到工作站。 下面介绍如何在此流程中使用每个设备。在物联网网关上,数字 I/O 端口 1-8 位于 A 组,而端口 9-16 位于 B 组。 ## 条形码扫描仪 第一步,操作员需要在开始工作前扫描条形码。该步骤可能如下所示: ![How To Include Factory Kit Devices in Apps_98636974.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636974%281%29.png) 您需要添加一个步骤触发器,以便操作员扫描完工单后进入下一个步骤。 ![How To Include Factory Kit Devices in Apps_98636975.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636975%281%29.png) 此外,您还需要将条形码编号存储为变量,以便与应用程序的完成相关联。 下面是触发器的外观: ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_193835640.png) 当 "语句查找条形码扫描仪的输出: ![How To Include Factory Kit Devices in Apps_98636977.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636977%281%29.png) - 当 "设备""条形码扫描仪 "在 "此站点 "输出时 第一个 "然后 "语句将条形码编号存储在名为 "work_order "的变量中: - "数据操作" "存储 "数据:"表达式" "@Deviceoutput.data +'' " 我们建议您在 Tulip 中将条形码值存储为文本值,这就是我们在表达式编辑器中添加引号和加号的原因。 [了解有关表达式编辑器的更多信息](https://support.tulip.co/docs/how-to-use-the-expression-editor-in-the-app-editor) 转换将操作员发送到下一步。 ![How To Include Factory Kit Devices in Apps_98636979.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636979%281%29.png) - "转到下一步 ## 从拾取到点亮 在下一个步骤中,操作员需要从其工作站的一系列垃圾箱中抓取一个白色盘子。这就是步骤设计: ![How To Include Factory Kit Devices in Apps_98636980.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636980%281%29.png) 操作员的工位上可能有一组 8 个垃圾桶,"从一个垃圾桶到另一个垃圾桶 "将点亮第 8 个垃圾桶。 ![How To Include Factory Kit Devices in Apps_98636982.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636982%281%29.png) 实际上,您需要两个台阶触发器来管理这个工位: 1. 当台阶打开时,点亮相应的料箱 2. 当台阶关闭时,关闭所有灯光。 下面是第一部分的触发器: ![How To Include Factory Kit Devices in Apps_98636984.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636984%281%29.png) 然后 "语句通过物联网网关连接到照明套件。然后,点亮拾取到灯条上的第 8 盏灯。 ![How To Include Factory Kit Devices in Apps_98636988.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636988%281%29.png) - 运行设备功能""灯具套件""打开 "此站 "的 "一个垃圾桶" - bin:"静态值""整数""8 "颜色:(绿色) 下面是步骤关闭时运行的触发器: ![How To Include Factory Kit Devices in Apps_98636990.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636990%281%29.png) 然后 "语句会关闭 "从拾到灯 "上的所有灯。 ![How To Include Factory Kit Devices in Apps_98636991.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636991%281%29.png) - "运行设备功能""照明套件""此站点 "的 "所有料箱关闭" ## 断开光束 Pick to Light 不能接受用户输入。它只能响应郁金香播放器中的事件。 另一方面,当人的手穿过传感器时,断路器可以触发郁金香播放器中的触发器。 为了实现这一功能,您需要在应用程序的第一步创建一个触发器,为折断光束供电。这样,它就能开始监视视野内的移动。 为了给断裂光束供电,请在应用程序中需要观察移动的步骤之前添加该触发器。 ![How To Include Factory Kit Devices in Apps_98636993.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636993%281%29.png) 当 - "步骤已打开 然后 - "在此站 "运行设备功能""GPIO""设置数字输出 - 引脚上:"静态值""整数""8 "到状态:"静态值" "布尔值" "是" 好了,现在可以观察特定垃圾桶的移动了。 ![How To Include Factory Kit Devices in Apps_98636997.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636997%281%29.png) 在上面的同一个步骤中,假设只有在一个人成功挑选了一个零件后,您才允许步骤前进。 ![How To Include Factory Kit Devices in Apps](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98636988.png) 下面就是这种情况: ![How To Include Factory Kit Devices in Apps_98637000.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637000%281%29.png) 当网关上的任何 GPIO 端口发生 "Pin up 事件 "时,触发器触发。 ![How To Include Factory Kit Devices in Apps_98637005.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637005%281%29.png) 当 - "设备""GPIO "在 "此站点 "输出 "Pin up "事件 然后 - "转到下一步 如果您查看一下物联网网关上的 I/O 输入 "A "组,就会看到这样的设置: ![How To Include Factory Kit Devices in Apps_98637010.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637010%281%29.png) 在这种情况下,断路器是唯一连接到 I/O 输入端的设备。 - 棕色导线提供电源 - 蓝线为设备接地 - A 组端口 1 的黑线实际上是在有东西穿过横梁后发送输入。 因此,触发器可以在所有 I/O 端口中寻找 "针脚向上 "事件。只有当有物体穿过光束时,"Pin up "才会触发。 ## 脚踏板 假设您想让操作员在不接触屏幕的情况下进入下一步。脚踏板是一种非常简单的方法。 下面是 "当 "语句的样子: ![How To Include Factory Kit Devices in Apps_98637011.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637011%281%29.png) 当 - "设备""脚踏板 "在 "此站 "输出 ## 灯光堆栈 假设操作员发现了一个缺陷,您需要一种方法让他们迅速通知主管。检查步骤可能是这样的 ![How To Include Factory Kit Devices in Apps_98637013.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637013%281%29.png) 当操作员点击 "Fail(故障)"时,您希望安灯上的红灯亮起。您可以通过一个按钮触发器来实现这一目的。 ![How To Include Factory Kit Devices in Apps_98637014.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637014%281%29.png) 然后 - "运行设备功能""GPIO""设置数字输出",在 "此站 "的引脚 "静态值""整数""2 "上设置 "静态值""布尔""是"。 - "转到步骤""缺陷报告 在第一个 "然后 "语句中,触发器向物联网网关 "输出 "部分的第二个引脚发送信号。红灯连接到该引脚,而绿灯则连接到第 1 个引脚(或您所连接的任何引脚)。 然后,操作员被发送到一个名为 "缺陷报告 "的表单步骤。 下面是这个光栈与网关的连接方式。 ![How To Include Factory Kit Devices in Apps_98637018.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20To%20Include%20Factory%20Kit%20Devices%20in%20Apps_98637018%281%29.png) - 白线将设备接地 - 绿灯与绿灯相连,与第一个引脚相连 - 与红灯相连的红灯连接到第二个引脚上 因此,当 "然后 "语句包括 "设置数字输出 "时,意味着它可以向 8 个 "输出 "引脚之一发送信号。 ## 更多阅读 以下是几种了解郁金香触发器的方法。 - [10 种常见触发器](/r230/docs/what-are-the-top-10-most-common-triggers) - [使用条形码扫描仪设置工作指南应用程序](/r230/docs/how-to-build-a-digital-work-instructions-app)