More practical windmills - i.e. those used to grind grain or draw up water - were invented in Persia in the 9th century CE. They had sails that spun around horizontally.
In Europe the earliest recorded windmills (in the 12th century) had sails that spun in a vertical plane. The sails were made of a framework with sailcloth stretched over it. If the wind speed changed the miller would need to stop the mill and alter the coverage of the sailcloth. By the 19th century sails had been designed to have slats and they could automatically adjust to the wind speed.
Most windmills have four sails, but those with more sails were built, both in Britain and, earlier, in areas of Spain, Portugal and Greece.
The inside of a windmill contains gears. As the sails move the axis they are fixed upon moves the 'brake wheel'. This has teeth that drives a horizontal gearwheel and transfers the power to the mill stones. There are often other gear wheels that help to hoist sacks or drive other machinery.
The basic design of the windmill has not only been used to grind grain, but also to power papermills, threshing mills and wind-driven water pumps.
More recently, windmills have led to the design of wind turbines which generate electricity and provide a possible alternative energy source to fossil fuels.