Added chainLength method
Copied the new arduino changes back to the main one.