The importance of a multiscale modeling to describe the behavior of materials with microstructure is commonly recognized. In general, at the different scales the material may be described by means of different models. In this paper we focus on a specific class of materials for which it is possible to identify (at the least) two relevant scales: a macroscopic scale, where continuum mechanics applies; and a microscale, where a discrete model is adopted. The conceptual framework and the theoretical model were discussed in previous work. This approach is well suited to study multifield and multiphysics problems. We present here the multiscale algorithm and the computer code that we developed to implement this strategy. The solution of the problem is searched for at the macroscale using nonlinear FEM. During the construction of the FE solution, the material behavior needs to be described at Gauss points. This step is performed numerically, formulating an equivalent problem at the microscale where the inner structure of the material is described through a lattice-like model. The two scales are conceptually independent and bridged together by means of a suitable localization-homogenization procedure. We show how different macroscopic models (e.g. Cauchy vs. Cosserat continuum) can be easily recovered starting from the same discrete system but using different bridges. The interest of this approach is shown discussing its application to few examples of engineering interest (composite materials, masonry structures, bone tissue).