The goal of this paper is to show that a distributed consensus mechanism can be implemented in a wireless sensor network exploiting the synchronization capabilities of relaxation oscillators, properly initialized with the measurements taken by their associated sensors. Relaxation oscillators are dynamic systems characterized by testability and high flexibility to produce waveforms with different characteristics. In particular, initializing each system with a function of the measurement, the state of the system may end up into two possible stable trajectories: a constant waveform, corresponding to a stable equilibrium point, or a periodic waveform, corresponding to a limit cycle. In the first case, the node does not transmit any signal. Conversely, in the second case, the node transmits a periodic signal like, e.g., a train of pulses. The approach proposed in this work has two purposes: a) design the oscillators' parameters so that they do not transmit when the measurement falls below a given threshold or they transmit a periodic pulse train, with a period inversely proportional to the measurement, when the measurement exceeds the threshold; b) make nearby oscillators to interact with each other in order to reach a consensus over globally optimal test statistics. Finally, the proposed scheme is applied to distributed multiple hypothesis testing for the recognition of the field monitored by a planar sensor network.