Important: You must power down your Pi before plugging any connector into the pins OR anything that hooks to any voltage. You can damage and even kill the pi if you don't power it down before plugging something into the pins.
Power down your pi.
Plug in your “T-Cobbler Plus” connector, as shown. Make sure you get the connector plugged in exactly over the pins as shown! Do not twist the cable/miss any pins, or it will not work.
Important step: This particular sensor is a “one-wire” sensor. You need to turn on the “one-wire” interfacing option to use the sensor.
Make sure the sensor is not backward. You can see in this image that the text is facing toward the resistor.
Connect the center pin to a 4.7 K ohm resistor.
Hook the right pin to GND (if the text is facing you)
Hook the left pin to 3V3
Open the editor “Thonny Python IDE”
Open the file from your downloaded examples : temperature_sensor.py
You may want to save a copy so you have the original.
Press “Run” in Thonny.
When you press the button you should see "button pressed" in the debug window.
Press “stop” to stop running the file.
! - Now that you've finished this exercise, turn the 1-wire interface off (instructions above)
Challenges
Can you have an LED turn on when the temperature rises above a threshold you determine?
Can you have a button that triggers the temperature reading process?