If you work with Arduinos or Intel Galileo, you will surely be a fan of Grove. Grove is great, you only need to Plug and play sensors and lets you prototype very quickly with the boards. In a couple of seconds you can have a great layout with sensors and actors connected to each other.
The funny thing is that when you decide to use “not grove” sensors to connect them to a Shield Grove, you get get to study a little before you can use them. For example, if we compare the 2 versions of the ultrasonic sensor we will see that the Grove version has 4 connectors and the normal version only 3.
When we read the specifications from the normal version (red one), we see that also this version does not bring a series of libraries or headers C to use on our Arduino projects. The code example includes all of the code to see how works at low level sensor.
The following lines are worth gold, we see that to “take away” what makes the sensor is
-Initializes the pin in OUTPUT mode
-several milliseconds apart, performs several digitalWrite() actions to send information to the PIN
-changes the mode of the pin to INPUT
-use pulseIn() to determine the “distance” which was collected by the sensor.
And ready! then a couple of conversions to return centimeters or inches and the sensor is working. If we now that this sensor works on a single grove plate we need to respect the cables for power and ground (red and blue); e reverse the data cables. Since the signal sensor takes is captured in the white wire and plate Grove the yellow cable is used to define the Pin.
.Greetings @ Home