machine
This module contains specific functions related to the hardware.
It allows to achieve control of CPU, timers, buses, memory and other hardware blocks on a system.
Chip
| Function |
Purpose |
freq() |
Return CPU frequency in Hertz |
reset() |
Reboot the board |
unique_id() |
Return unique identifier of a chip |
lightsleep() |
Low-power sleep, resumes on wake-up |
deepsleep() |
Deepest sleep, reboots on wake-up |
Peripheral
| Class |
Purpose |
Pin |
Digital I/O |
ADC |
Analog I/O |
PWM |
Pulse-width modulation |
I2C / SPI / UART |
Communicating between devices |
Timer / RTC / WDT |
Hardware timer, real-time clock and a watchdog |
import machine
print(machine.unique_id().hex())
print(f"{machine.freq() // 1000000} MHz")