The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C# Code
Posted by: Roomba style Driving | February 10, 2011 @ 2:39pm
C# Code
[
Download
]
while (true) { //Get Ping Distance (front of car) ForwardDistance = ForwardPing.GetDistance(Parallax.Components.Ping.DistanceUnits.Inches); Debug.Print(ForwardDistance.ToString()); //Drive forward while distance is 2ft or more, drive forward and straight //When closer than 2ft back up and turn, then repeat if (ForwardDistance >= 24) { Futaba.SetPosition(100); Rooster.Drive(); } else //Stop car, turn wheels to the left, reverse for one second at lowest speed { Rooster.Stop(); // this doesnt exactly stop, just cuts motor drive, so it may still ram into things Futaba.SetPosition(80); Rooster.Reverse(); Thread.Sleep(1000); } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.56 / 8
64 Votes
http://codebin.yi.org/1101
page generated in 0.00 seconds