## 6. Counting Events

It is often necessary to count things, such as people walking past. If you want to do something along these lines later in your project, I recommend you take a closer look at this example:
https://makecode.microbit.org/_9fVKYs5ygUgu

On the hardware side, you have to connect the ultrasonic distance sensor to J1:

Overall, this code detects proximity events with a ultrasonic- sensor and periodically sends the detection count over LoRaWAN if the transmission conditions are met.