Mercury(II) iodide

Mercury(II) iodide, also known as mercuric iodide, is a chemical compound. Its chemical formula is HgI2. It has mercury and iodide ions in it. The mercury is in its +2 oxidation state.
Properties.
It is a red crystalline compound. It turns yellow when heated and turns red again when it is cooled. It is insoluble in water. It is highly toxic like all mercury compounds.
Preparation.
Mercury(II) iodide is made by reacting a mercury(II) salt such as mercury(II) chloride with a source of iodide ions. This makes a bright red precipitate.
Occurrence.
It is found as the very rare mineral coccinite.
Uses.
It was used as a medicine, but it poisoned people who took the medicine. It is also used to demonstrate how some things change color when heated and change back when cooled. It can be used to test for ammonia and as a semiconductor.