If the light is on while driving, then your battery is not being charged and there is a fault in the charging system.
Do not continue driving. Pull off at the first opportunity and seek assistance.
Usual problems: alternator failure, loose or broken alternator belt, faulty battery, broken wire
Charging systems produce a voltage while the engine is running, As long as the charging system is working, all of the power is delivered by the alternator.