added peripheral code for arduino
added watchdog and changes to connect disconnect