Need to figure out what version or OS your RPI is running? Find out if you are using Jessie, etc.
This is how you can find out.
Open terminal and type
To find out what RPI you actually have (the model) you can type
Then refer to the following list with your code to see what model you have: