Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8 Python Code for Lab In previous firmware offerings of Micropython (the language that, runs on the ESP32s), we have the board library available to

image text in transcribed

8 Python Code for Lab In previous firmware offerings of Micropython (the language that, runs on the ESP32s), we have the board library available to us. When we import this library we are able to map pin titles of specific breakout boards to the board's pin number. For instance, the Serial Clock and Serial Data pins - named SCL and SDA respectively - map to the hardware pins CIPOO numbers 22 and 23. Thes is really convenicnt because you can refer to pins by their names. However, in the latest implementation of Micropy thon that, we are using, board is no longer available. n this homework, though, we will be getting it back! For this problem, you will write a python file called board.py that will map pin names to their respective board numbers for our specilic ESI?32. board.py will have a function callexd get_pin. The sample use case is shown below. With the get.pin function from board.py notice that we didn't have to remember GI'IO pin numbers for SD A and SCL. Note that the things you import (libraries) are not anything special, they are just python files that have functionality that we would like to have locally, so we can "copy" their code using import statements to use in our new code. Hint: use a dictionary to store the mapping of pin names to numbers, and a function to return this value (callexi get-pin). from board import get_pin from machine import Pin, SoftI2C from ina219 import INA219 import time nsyyn 3 - vrainen 20123-00-12

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. How are language and thought related?

Answered: 1 week ago

Question

=+2 Why are international employment standards important to IHRM?

Answered: 1 week ago

Question

=+1 Why are local employment laws important to IHRM?

Answered: 1 week ago