If you need to determine the hardware revision of the micro:bit as part of your code, for example if your program uses a V2 API, but you still want it to run on a V1 micro:bit, you can do this as part of your program.


The hardware version API will return '2' if you are using a micro:bit V2 board or '1' if you are using a micro:bit V1, as described in how to identify the version number of your micro-bit.