Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Packet Tracer - SBC Actuate With Python Objectives Become proficient using Python to program Packet Tracer's SBC device. Background / Scenario Python is wide-spread, robust
Packet Tracer - SBC Actuate With Python Objectives Become proficient using Python to program Packet Tracer's SBC device. Background / Scenario Python is wide-spread, robust and easy to programming language that runs on several different computer platforms. Packet Tracer 7.1 takes advantage of this and implements Python-supported loT devices. In this packet Tracer activity you will program the Packet Tracer 7.1's SBC device using Python. The goal is to allow a coffee maker to start brewing coffee when someone enters the kitchen (movement is detected). A countertop lamp will also turn on. Required Resources Packet Tracer 7.1 Part 1: Adding and Connecting the Necessary Devices You will start with an empty work space. Add the following devices to Packet Tracer's work space: a. A SBC device can be found under Components >> Boards >> SBC-PT. b. A Coffee Maker can be found under End Devices >> Home >>Appliance. C. A Counter Top Lamp can be found under End Devices >> Home>> Light. d. A Motion Sensor can be found under Components >> Sensors >> Motion Sensor e. Change the names of the devices to match the diagram. f. Using lot Custom Cable, connect the devices to the PT-SBC board. The loT Custom Cable can be found under Connections Use the following table to find the correct ports: Device SBC Port Coffee Maker Lamp D1 D2 D9 Motion Sensor Part 2: Programming the SBC The SBC mimics real-world single board computers such as the Raspberry Pi. One of the advantages of SBC-PT is that it can be programmed with Python. Note: Python used in PT is an open source Python to JavaScript interpreter that is not updating to Python 3.0. For this reason there may be slight differences in the syntax between the code observed in PT and that in devices using Python 3. a. Click on the SBC and select the Programming tab. Is there any code pre-loaded in the SBC? The contents of the Programming tab are divided into two main parts. The left pane displays all the files containing the programs created by you. The right pane displays the contents of the file currently selected on the left portion. Click the New button above the left pane to create a new file. Name it main.py and select Empty - Python for the template type. Click Create. The left pane should now list your new file, main.py. b. On the left pane, select main.py and click Open; the Open button is located immediately above the left pane. The right pane is now ready to receive the code for your main.py program. C. Using the right pane, write a program to instruct the SBC to turn on the Coffee Maker and the Light when motion is detected by the Motion Detector. Part 3: Testing To test your code, first run the main.py by clicking Run. Then press the ALT key while moving the mouse over the Motion Sensor. This should signify movement to Packet Tracer which will be captured by the PT- Motion Sensor. Once movement is detected, a HIGH digital signal is sent to the SBC which in turn, turns on the coffee maker and the light. Messages also appear in the console of the SBC. Did the Coffee Maker turn on? Did the light turn on? What changes would have to be made in the SBC if the motion detector was moved to port D5? 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 2 of 3 Lab - SBC Actuate With Python What PT-SBC port, if any, should be used to connect an analog sensor? Packet Tracer - SBC Actuate With Python Objectives Become proficient using Python to program Packet Tracer's SBC device. Background / Scenario Python is wide-spread, robust and easy to programming language that runs on several different computer platforms. Packet Tracer 7.1 takes advantage of this and implements Python-supported loT devices. In this packet Tracer activity you will program the Packet Tracer 7.1's SBC device using Python. The goal is to allow a coffee maker to start brewing coffee when someone enters the kitchen (movement is detected). A countertop lamp will also turn on. Required Resources Packet Tracer 7.1 Part 1: Adding and Connecting the Necessary Devices You will start with an empty work space. Add the following devices to Packet Tracer's work space: a. A SBC device can be found under Components >> Boards >> SBC-PT. b. A Coffee Maker can be found under End Devices >> Home >>Appliance. C. A Counter Top Lamp can be found under End Devices >> Home>> Light. d. A Motion Sensor can be found under Components >> Sensors >> Motion Sensor e. Change the names of the devices to match the diagram. f. Using lot Custom Cable, connect the devices to the PT-SBC board. The loT Custom Cable can be found under Connections Use the following table to find the correct ports: Device SBC Port Coffee Maker Lamp D1 D2 D9 Motion Sensor Part 2: Programming the SBC The SBC mimics real-world single board computers such as the Raspberry Pi. One of the advantages of SBC-PT is that it can be programmed with Python. Note: Python used in PT is an open source Python to JavaScript interpreter that is not updating to Python 3.0. For this reason there may be slight differences in the syntax between the code observed in PT and that in devices using Python 3. a. Click on the SBC and select the Programming tab. Is there any code pre-loaded in the SBC? The contents of the Programming tab are divided into two main parts. The left pane displays all the files containing the programs created by you. The right pane displays the contents of the file currently selected on the left portion. Click the New button above the left pane to create a new file. Name it main.py and select Empty - Python for the template type. Click Create. The left pane should now list your new file, main.py. b. On the left pane, select main.py and click Open; the Open button is located immediately above the left pane. The right pane is now ready to receive the code for your main.py program. C. Using the right pane, write a program to instruct the SBC to turn on the Coffee Maker and the Light when motion is detected by the Motion Detector. Part 3: Testing To test your code, first run the main.py by clicking Run. Then press the ALT key while moving the mouse over the Motion Sensor. This should signify movement to Packet Tracer which will be captured by the PT- Motion Sensor. Once movement is detected, a HIGH digital signal is sent to the SBC which in turn, turns on the coffee maker and the light. Messages also appear in the console of the SBC. Did the Coffee Maker turn on? Did the light turn on? What changes would have to be made in the SBC if the motion detector was moved to port D5? 2017 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public. Page 2 of 3 Lab - SBC Actuate With Python What PT-SBC port, if any, should be used to connect an analog sensor
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started