  We consider an energy functional combining the square of the local
oscillation of a one--dimensional function with a double well potential. We
establish the existence of minimal heteroclinic solutions connecting the two
wells of the potential.
  This existence result cannot be accomplished by standard methods, due to the
lack of compactness properties.
  In addition, we investigate the main properties of these heteroclinic
connections. We show that these minimizers are monotone, and therefore they
satisfy a suitable Euler-Lagrange equation.
  We also prove that, differently from the classical cases arising in ordinary
differential equations, in this context the heteroclinic connections are not
necessarily smooth, and not even continuous (in fact, they can be piecewise
constant). Also, we show that heteroclinics are not necessarily unique up to a
translation, which is also in contrast with the classical setting.
  Furthermore, we investigate the associated Dirichlet problem, studying
existence, uniqueness and partial regularity properties, providing explicit
solutions in terms of the external data and of the forcing source, and
exhibiting an example of discontinuous solution.
