Functions | |
| def | user_button_pressed (IRQ_source) |
| Callback which runs when the user presses the blue input button on the Nucleo. More... | |
Variables | |
| user_button = pyb.Pin(pyb.Pin.cpu.C13, mode=pyb.Pin.IN) | |
| A pin object bound to the user button (Pin PC13) More... | |
| extint = pyb.ExtInt(user_button,pyb.ExtInt.IRQ_FALLING,pyb.Pin.PULL_NONE,user_button_pressed) | |
| The callback for the user button. More... | |
| board_LED = pyb.Pin(pyb.Pin.cpu.A5, mode=pyb.Pin.OUT) | |
| A pin object bound to the board Led (Pin A5) More... | |
| int | PRESS = 0 |
| A boolean indicating if the user button has been pressed. More... | |
| start_time = utime.ticks_ms() | |
| The starting timestamp for the temperature recording program. More... | |
| core_sensor = pyb.ADCAll(12, 0x70000) | |
| The ADCALL object used to measure the Nucleo's core temperature. More... | |
| vref = core_sensor.read_core_vref() | |
| The Nucelo's reference voltage. More... | |
| i2c = I2C(1, I2C.MASTER) | |
| The pyb.I2C object used to communicate with the MCP9808 sensor. More... | |
| temp_sensor = MCP9808(i2c,0) | |
| The mcp9808 object connected to the external temperature sensor. More... | |
| bool | Press = False |
| cur_time = utime.ticks_ms() | |
| el_time = utime.ticks_diff(cur_time,start_time) | |
| core_temp = core_sensor.read_core_temp() | |
| The Nucleo's core temperature in C. More... | |
| amb_temp = temp_sensor.celcius() | |
| The ambient temperature read by the MCP9808 sensor in C. More... | |
| def LAB_0x04_main.user_button_pressed | ( | IRQ_source | ) |
Callback which runs when the user presses the blue input button on the Nucleo.
This function is triggered when the Nucleo's onboard button is pressed. It records the reaction timer count, indexes the number of presses, and check to see if the button was pressed early.
| IRQ_source | The source of the interrupt. This must be taken as an arg, but is not used |
| LAB_0x04_main.amb_temp = temp_sensor.celcius() |
The ambient temperature read by the MCP9808 sensor in C.
| 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)
| LAB_0x04_main.core_sensor = pyb.ADCAll(12, 0x70000) |
The ADCALL object used to measure the Nucleo's core temperature.
| LAB_0x04_main.core_temp = core_sensor.read_core_temp() |
The Nucleo's core temperature in C.
| LAB_0x04_main.cur_time = utime.ticks_ms() |
| LAB_0x04_main.el_time = utime.ticks_diff(cur_time,start_time) |
| 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.
Activation occurs on a falling edge.
| LAB_0x04_main.i2c = I2C(1, I2C.MASTER) |
The pyb.I2C object used to communicate with the MCP9808 sensor.
The communication channel is opened on bus 1, and the Nucleo is designated as the master.
| int LAB_0x04_main.PRESS = 0 |
A boolean indicating if the user button has been pressed.
| bool LAB_0x04_main.Press = False |
| LAB_0x04_main.start_time = utime.ticks_ms() |
The starting timestamp for the temperature recording program.
The mcp9808 object connected to the external temperature sensor.
| 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)
| LAB_0x04_main.vref = core_sensor.read_core_vref() |
The Nucelo's reference voltage.