U3-L1

Created
    English
  1. Computers
  2. 8 Grade
  3. Naila Obaid
Best for asynchronous learning and homeworkAssign in student-paced mode
Best for live in-class or video conferencing lessonsStart teacher-led lesson
Preview as student
Worksheet Image

Unit 3: Embedded Systems Embedded Systems o The ry Activity 2 Complete THREE embedded systems in your family car and identify the purpose of the system, the input, process, and output for each. One is completed as an example. Embedded Purpose Input Process Output System Traction Allows a car If the wheels control to accelerate are spinning system Motors to and brake or there is Wheel speed control breaks smoothly not enough sensors and wheel even in traction apply speed slippery the brakes conditions slowly Anti-lock braking system (ABS) Check engine system 58 Copyright © Ministry of Education – United Arab Emirates

Worksheet Image

G8-Activity book Seat belt system Lab Activity 3 Fatima is learning about standard programming libraries. Create a text-based program to show how to use a standard programming library to count up to 10 seconds, then execute the program. The program will: • import the time library • use a count-controlled loop • use a print command for output • use a time.sleep command to wait one second between each output 59 Copyright © Ministry of Education – United Arab Emirates

Worksheet Image

Unit 3: Embedded Systems Lab Activity 4 Ibrahim is learning about standard programming libraries. Create a text-based program to show how to use a standard programming library to program rolling a die, then execute the program. The program will: • import the random library • use a random.randrange command to return a value between 1 and 6 • use a variable to store the random number • use a casting command to format the output for example: “You rolled a die and scored 5” ac ter tiv In e Activity 5 Fatima wants to review programming libraries. Explain the purpose and real-world applications of programming libraries. Use the words to fill in the blank spaces. libraries functions extra programs collection game Programming libraries are a ______________ of pre-programmed commands, _____________ and modules that can be used in programs. Programming __________________ can be used to simplify the programming process by removing the need to rewrite commonly used commands. They are also used to add ________________ capabilities and functionality to _____________________. 60 Copyright © Ministry of Education – United Arab Emirates

Worksheet Image

G8-Activity book Some real-world applications of programming libraries are: • TensorFlow which is used to program machine learning models. • Numpy which is used to create and manage advanced data storage. • OpenCV which is used for image processing in computer vision applications. • Pygame which is used to program graphics and sounds for computer __________________ development. What is physical computing? Lab Activity 6 Fatima is learning about programming an LED component. Remember, an LED is a digital component used to output with a light. Create a text-based program to demonstrate how to communicate with and control a hat and LED component using a microcontroller, then execute the program. The program will: • import a communication library and configure communication settings • turn on an LED light • use a command to wait 20 seconds • end the communication Challenge Add more code to the program to: • use repetition to make the LED blink (turn on and off) ten times • use a command to wait one second between each blink 61 Copyright © Ministry of Education – United Arab Emirates

Worksheet Image

Unit 3: Embedded Systems Lab Activity 7 Ibrahim is learning about programming a push button component. Remember, a push button is a digital component for user input. Create a flowchart algorithm to demonstrate how to communicate with and control a hat and push-button component using a microcontroller. Use the space provided below. The flowchart will: • import a communication library and configure communication settings • use a while True: command to create a forever loop • if the push button is pressed • output “User pressed the button” • end the program using a keyboard interrupt (Ctrl +C Keys on the keyboard) Here is an example showing how to program a push button component: 1. # ! /user /bib/python3 2. from python_aio.python import pyMata3 3. from python_aio.constants import Constants 4. board = pyMtat3(arduino_wait=2) 5. Button = 3 6. board.set_pin_mode(Button, Constants, INPUT) 7. try: 8. while True: 9. if board.digital_read(Button == 1: 10. print(“User pressed a button”) 11. board.sleep(0.01) 12. except KeyboardInerrup: 13. board.shutdown() 62 Copyright © Ministry of Education – United Arab Emirates