getting entity field values programmatically is easy, but check this out. With this snippet you get the value directly of a single field value:
$entity->get("fieldName")->getString();