Can you put a child who is not yet old enough to understand (lo higyah lichinuch) Shabbos in front of a light switch in order that he or she turn the light off or on? Is there a difference between the two: turning the light off versus turning it on? (This question is about lights in particular.)
The following is based wholly on Children in Halacha by Rabbi Simcha Bunim Cohen (Artscroll, 1st ed.), chapters 1 and 4:
The age of chinuch for forbidden activities is from when a kid will not do something later if you tell him now that it's the kind of thing he can't do. This is about age four. From that age, you cannot allow your kid to do any m'lacha on Shabas. Until that age, it's okay if your kid does (and even if you encourage your kid to do) m'lacha d'rabanan, not d'oraysa, provided he's (to his mind) doing it for his own benefit.
Turning off an incandescent bulb is a d'rabanan; turning one on is a d'oraysa.
One cannot do an Issur D'Rabbanan by means of a child(Shulchan Arukh 309:1 also see Mishna Berurra there), such as carrying muktze, kal v'homer one can not violate an Av Malakha(Kindling or Extinguishing both are Av Malakhot) by means of a child. A light may be extinguished for the sake of an ill person for whom there is danger(Shulchan Arukh 278:1)
It is muter to extinguish a candle to enable a sick person at risk to fall asleep.
However Mishnah Berurra 1 says that this only applies after all other options have been exhausted. Also in that particular vein of thought one must consider what is written in the Shulchan Arukh 328:12
When violating the Shabbos for the sake of pikuach nefesh, gentiles, children and women should not be used, rather it should be violated by adults and mature males. RAMA Some are of the opinion that if it is possible to make a shinui without causing any delay, one should. If it is possible to use gentiles without causing a delay, one should use a gentile, and such is the custom. When there is room to believe that the gentile will dally then a gentile must not be used.
The Halakha is quite clear for Sephardim and all of the major poskim hold verbatim by the Mechaber. By Ashkenazim it gets a little more complicated, however the Mishnah Berurrah 37 and Rav S.Z. Auerbach, as brought in Shmirat Shabbat Kehilchata 32:28 rule in accordance with Mechaber.
As far as having a child extinguish a fire in any case there are the Mishna Berurrahs brought on the Shulchan Arukh 334:26, as well as the Kaf HaChaim there, and the Yalkut Yosef 334:18.
In short using a child to perform an Av Melakha even in a case of Pikuach Nefesh is highly problematic.