There is an IncreasingPriceCrowdsale in OpenZeppelin Contracts 2.x that you could use for inspiration.
I put together an example of manually setting a crowdsale rate using this. This code has not been tested or audited. Please appropriately test and audit before using in production. Setting crowdsale rate manually