Lab0x04: Hot or Not? main file. More...
Namespaces | |
| LAB_0x04_main | |
Functions | |
| def | LAB_0x04_main.user_button_pressed (IRQ_source) |
| Callback which runs when the user presses the blue input button on the Nucleo. More... | |
Variables | |
| LAB_0x04_main.user_button = pyb.Pin(pyb.Pin.cpu.C13, mode=pyb.Pin.IN) | |
| A pin object bound to the user button (Pin PC13) More... | |
| LAB_0x04_main.extint = pyb.ExtInt(user_button,pyb.ExtInt.IRQ_FALLING,pyb.Pin.PULL_NONE,user_button_pressed) | |
| The callback for the user button. More... | |
| LAB_0x04_main.board_LED = pyb.Pin(pyb.Pin.cpu.A5, mode=pyb.Pin.OUT) | |
| A pin object bound to the board Led (Pin A5) More... | |
| int | LAB_0x04_main.PRESS = 0 |
| A boolean indicating if the user button has been pressed. More... | |
| LAB_0x04_main.start_time = utime.ticks_ms() | |
| The starting timestamp for the temperature recording program. More... | |
| LAB_0x04_main.core_sensor = pyb.ADCAll(12, 0x70000) | |
| The ADCALL object used to measure the Nucleo's core temperature. More... | |
| LAB_0x04_main.vref = core_sensor.read_core_vref() | |
| The Nucelo's reference voltage. More... | |
| LAB_0x04_main.i2c = I2C(1, I2C.MASTER) | |
| The pyb.I2C object used to communicate with the MCP9808 sensor. More... | |
| LAB_0x04_main.temp_sensor = MCP9808(i2c,0) | |
| The mcp9808 object connected to the external temperature sensor. More... | |
| bool | LAB_0x04_main.Press = False |
| LAB_0x04_main.cur_time = utime.ticks_ms() | |
| LAB_0x04_main.el_time = utime.ticks_diff(cur_time,start_time) | |
| LAB_0x04_main.core_temp = core_sensor.read_core_temp() | |
| The Nucleo's core temperature in C. More... | |
| LAB_0x04_main.amb_temp = temp_sensor.celcius() | |
| The ambient temperature read by the MCP9808 sensor in C. More... | |
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 "temp_data.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.
** This is the main file I wrote to test battery powered collection. I had to add a way to trigger collection without a PC, so included the use of the user button.
The source code for this file can be found here:
https://bitbucket.org/ewnichol/me305-me405_labs/src/master/me405/me405%20Lab%200x04/LAB_0x04_main.py