Answered step by step
Verified Expert Solution
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
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
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