judge shall ascertain whether the minor or his parent or guardian has been informed of the right of the minor to be represented by counsel, and if not, the judge shall advise the minor and the parent or guardian, if present, of the right to have counsel present. If the parent or guardian is indigent and desires to have the minor represented by counsel, the court may appoint counsel to represent the minor, and in 