How can i use 2 temperature (ds18b20) sensors with raspberry pi? If I can, what gpio pins should I use and how? So what pin can i use instead of gpio 4...
The Raspberry Pi supports one 1-wire bus (currently, in the future more may be supported).
Each 1-wire bus supports an arbitrary number of 1-wire sensors so you can add as many DS18B20 as you want.
By default the 1-wire bus is connected to GPIO 4 (pin 7).
You enable the 1-wire bus by adding the following line to
If you want to use an alternate GPIO change 4 to the (Broadcom numbered) GPIO you want to use.
There are several examples of reading the DS18B20 if you use the site search engine.