View Single Post
  #2   Spotlight this post!  
Unread 01-03-2010, 21:57
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: solinoid problem

This bit of code ought to do what you want. It's untested, and I might have gotten something backwards, so don't trust it until you understand it.

The feedback node remembers the last time the input boolean was true. The constant "500" is in milliseconds. When the program begins, the output boolean is false. When the input boolean goes true, the difference between the current time and the remembered time becomes zero and the output goes true. When the input boolean goes false, the difference starts increasing. The output remains true until the elapsed time reaches the constant value, then stays false until the next time the input goes true.
Attached Thumbnails
Click image for larger version

Name:	delay.jpg
Views:	19
Size:	6.8 KB
ID:	8824