View Single Post
  #2   Spotlight this post!  
Unread 01-28-2016, 09:48 AM
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 985
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Noob question for teleop

The variable "gyro" is declared and used but never instantiated. This means that "gyro" is null when you call .getAngle on it in Teleop which crashes your code.

2 things to do to fix it:
1. Either remove "gyro" if you don't have a gyro or instantiate using a line like gyro= new AnalogGyro(1) if you do.
2. Set your Driver Station messages window to "+Prints" using the little gear above the messages. You would have seen the stack trace from the code crashing there if you had it set this way which would have told you that it was a Null Pointer exception and the line number.
Reply With Quote