View Single Post
  #3   Spotlight this post!  
Unread 24-02-2015, 07:46
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Robot drives forward with no joystick connected

We added code to check the array size of the POV before blindly indexing it.

The attached image returns a -1 instead of a zero. This still may not be what you want, but it shows how to detect an empty array and control the downstream value. You can also put your code into a case structure and only execute it if the array size is not zero.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	From Clipboard.PNG
Views:	18
Size:	9.7 KB
ID:	18472  
Reply With Quote