Mainly arduino code