  In this article we present a class of codes with few weights arising from
special type of linear sets. We explicitly show the weights of such codes,
their weight enumerator and possible choices for their generator matrices. In
particular, our construction yields also to linear codes with three weights
and, in some cases, to almost MDS codes. The interest for these codes relies on
their applications to authentication codes and secret schemes, and their
connections with further objects such as association schemes and graphs.
