Have you ever seen a lightning flash or heard the thunder of lightning and wondered how close you were from the lightning strike? Have you noticed that there often was a delay between the flash of light and the clap of thunder when a lightning occurs?
It is possible to calculate the distance to a lightning strike by counting the seconds between the lightning flash and the sound of thunder.
When lightning strikes, the first thing you see is the flash of light which you can see instantly. This is because light travels at a very high speed (Speed of light = 300,000 km/s). At the same time a clap of thunder is created. However, in the air a sound wave does not travel as fast as light, so it may take a few seconds for this clap of thunder to reach you. This depends on how far you are from the lightning.
Look at the following diagram and check the formula of speed. Bear in mind that the speed of a sound wave in the air is 340 m/s.
Write a program for the BBC micro:bit that will allow the user to:
- Press the A button of the micro:bit when they spot a lightning flash.
- Press the B button of the micro:bit when they hear the thunderstorm.
- Display the distance (in meters) from the lightning strike using the LED screen.