libelium-dev wrote:
maeishoj,
If you want to use this sensor with Waspmote, please take a look at this examples to see how to manage analogue and digital I/O of Waspmote. It will be useful for you.
AnalogDigital I/OYou should adapt your arduino code to Waspmote.
Could you please post a picture showing how are you connecting the sensor?
Best regards.
Hello dev!
I don't have a picture right now, but I can tell you how! :)
VCC I tried to connect it to both 3 and 5 V. GND TO GND. Then I connected Trigger to DIGITAL5 and Echo to DIGITAL7 (EP AND TP in that code).
All it has to do as I see is: First I have to power the sensor, so how would you suggest me to do that?
like this: digitalWrite(SENS_PW_3V3, HIGH); ? What about if I have to use the 5V ?
Then the steps for measuring are:
put down the trigger pin to be sure it's a clean read, wait 2 us, put it high for making a measurement,wait again, put it low again and then read the PulseIn (like i do with the other sensor I was using, that you helped me with):
digitalWrite(TP, LOW);
delayMicroseconds(2);
digitalWrite(TP, HIGH); // pull the Trig pin to high level for more than 10us impulse
delayMicroseconds(10);
digitalWrite(TP, LOW);
long microseconds = pulseIn(EP,HIGH); // waits for the pin to go HIGH, and returns the length of the pulse in microseconds
The example you linked me does not say much about it.. Because who cares in these situations about reading the value of a digital pin? The only thing they are used for is to trigger the measurement to happen, and the actual reading of the value is done with PulseIn right?
can you please try to help me out here?
I appreciate your help!