View Single Post
  #13   Spotlight this post!  
Unread 27-02-2012, 21:20
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: What's the best way to test?

Quote:
Originally Posted by RyanN View Post
The Accumulation code makes sense, but won't work they way you think it will. You've created a rising edge (on button press) code trigger with the feedback node and the greater than > block. What this means is that the code will execute exactly one time when you press it down, and won't execute it again until you release and press that button again. Good job from this point.

Inside the case structure you have a T/F from another feedback node. So you'll press it once, and the motor will stop (from value 0), and then you press it again, it will go full 'forward' (from value 1) once the NOT block inverts your boolean F to T. So here's another good job from me.

The problem is that you are not constantly feeding the motor with a value. For safety purposes, motors are not allowed to continue their set value unless it is fed a value every so many milliseconds (I think it's like every 100ms). If you look at the given autonomous code, you'll see that they use a while loop instead of the simpler sequence structure. This is why this is done.

You can simply add another feedback node, with the motor control value in it, then add the motor to the outside of the case structure, as shown in the picture attached.

Attachment 12130

Here's how I would do it, because case structures clutter up the work area, plus it hides half of the code that can execute.

Attachment 12131
Ignore my shoddy explanation, here's a picture of the code I'm trying to describe.
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	21
Size:	34.9 KB
ID:	12134  
Reply With Quote