How to make adjustable frequency generator from 1hz to 4mhz?

Hello, So I need an adjustable frequency for a few projects I'm working on. The frequency range must be 1Hz to around 4Mhz. https://www.reddit.com/r/arduino/comments/3898g6/generating_14_mhz_clock_on_arduino/. That post was helpful, but I need an adjustable signal. Also, I want it to display the value on a LCD screen. Can someone please help, and can you provide an explanation?

you can use an Arduino Uno with a 10K pot and 10K resistor on A0 analogue input then read the value and then map to another set of values to produce a square wave on one of the digital outputs with a 50 % duty cycle and depending on what output voltage you need feed a Pwr transistor or MOSFET. I bread boarded and tested the circuit but didn't want to waste an Arduino to do it. Then you can connect a 16x2 LCD panel and do a serial print of any variable you wish. You can use OP amps as well to make a function generator. A 555 timer IC will do up to the 100khz level. I do have the Arduino sketch somewhere if needed.

the library you need to search for is toneac and on that site is all the info you need to generate a square wave of variable frequency it was designed for audio range but if you change the map values you can get a higher frequency. It is output on pin 5 only so the LCD library if using a display would need an alternate pin or use a smart lcd and serial output to it. Note it is square wave TTL level that can feed CMOS or TTL circuits. If you wanted triangle waves an OP AMP circuit is needed. An N channel MOSFET can amplify if needed. You will need to download the toneac library and #include it to compile.