An electronic device includes: a main unit; a cap unit that is capable of
having a portable electronic device attached thereto and is capable of
tilting; a driving unit that causes the cap unit to tilt with respect to
the main body; and a controlling unit that drives the driving unit so as
to return the cap unit to a reference position, when detachment of the
portable electronic device from the cap unit is detected.