Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
EmbrioAdmin  
#1 Posted : Monday, August 17, 2015 4:23:39 PM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 81 time(s) in 76 post(s)
For discussion about the 4 Pin Ultrasonic Sensor library item.
SomeAssembly  
#2 Posted : Tuesday, August 18, 2015 4:03:41 AM(UTC)
SomeAssembly

Rank: Advanced Member

Groups: BetaUser, Registered
Joined: 3/31/2015(UTC)
Posts: 47

Hi;

I use a maxPulse setting of 5555, this is real close to 1 meter. My robot car is quite fast and being able to have a large range helps to avoid crashes (sometimes).

The one meter equates very well to the 0-1 of the output activation; 0.2 = 20 cm.

Remember to keep it as small as works for your project, without a response from the sensor this pulse time is equal to a delay in your program.

Mike
SomeAssembly  
#3 Posted : Tuesday, August 18, 2015 4:10:07 AM(UTC)
SomeAssembly

Rank: Advanced Member

Groups: BetaUser, Registered
Joined: 3/31/2015(UTC)
Posts: 47

Hi;

I also added a line to help with consistent behavior, I found that the output would go back to zero if no object was in range. This made for some fun experiments and hard crashes.

I just added this line before the output activation line in the code:

if(duration == 0) duration = maxPulse;


Mike
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error