Getting Values from the SmartDashboard

How do we get values from the smartdashboard? We tried putting a default value using SmartDashboard.put(“P”, 1). Then trying to get the value with SmartDashboard.get(“P”). This doesn’t work. Anytime we try changing the values from the default value of 1 it goes back to the default value. Does anyone know how to get values from it? Please be descriptive because we are very new to SmartDashboard?

Without your code, I would assume that the reason that the number keeps changing back to 1 is that you are putting the default value of 1 repeatedly in a loop. When you say doesn’t work, do you mean that the get method returns 1, nothing, or crashes? And which put/get methods are you using? putNumber? putDouble? If you are using the getNumber method, you have to use SmartDashboard.putNumber(“P”, someDefaultValue), where the default value is essentially the backup value if it can’t find the actual one.

It would help everyone help you if you put some of your code below (and don’t forget to use CODE tags)