Lab0x04: Hot or Not? main file. More...
Variables | |
| Lab4_main.adc = pyb.ADCAll(12, 0x70000) | |
| Initializes the pyb.ADCAll object. | |
| Lab4_main.i2c = I2C(1, I2C.MASTER, baudrate= 115200) | |
| Initializes the Nucleo as the MASTER in the I2C interface. | |
| Lab4_main.start_time = utime.ticks_ms() | |
| Start time of the data collection. | |
| Lab4_main.mcp = MCP9808(i2c) | |
| Initializes the mcp9808 driver using the I2c object. | |
| Lab4_main.curr_time = utime.ticks_ms() | |
| Initializes reference voltage of the adc object. | |
| int | Lab4_main.time = utime.ticks_diff(curr_time, start_time)/1e3 |
| Lab4_main.T_core_C = adc.read_core_temp() | |
| Core temperature in Celsius. | |
| int | Lab4_main.T_core_F = adc.read_core_temp()*9/5 + 32 |
| Core temperature in Fahrenheit. | |
| Lab4_main.T_amb_C = mcp.celcius() | |
| Ambient temperature in Celsius. | |
| Lab4_main.T_amb_F = mcp.fahrenheit() | |
| Ambient temperature in Fahrenheit. | |
Lab0x04: Hot or Not? main file.
This main file is used to measure two sets of data: the internal temperature of the microcontroller and the ambient temperature. It will record these measurements every 60 seconds along with the timestamp at which the measurements were taken. This data is then appended to a CSV file called "TempData.csv". Column 1 is the time stamp in seconds, column 2 is the core temperature in Celsius, and column 3 is the ambient temperature of the room in Celsius.
If the sensor is not read or set up incorrectly (manufacturer ID is incorrect), the code will return an error message in the REPL.
The source code for this file can be found here: https://bitbucket.org/ewnichol/me405_shared_work/src/master/me405%20Lab%200x04/main.py