title: can not read temp from ds18b20
body: <p>I am using stm32 to read the ds18b20 with HAL library</p>
  
  <p>I think the init is correct but the read and write is not</p>
  
  <p>anyone can tell me why it is not right?</p>
  
  <p>for the write,here is the code</p>
  
  <pre><code>if ((data &amp; (1 &lt;&lt; i)) != 0)
          {
              MX_GPIO_Set(1);
              HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET);
              delay_ms(1);
  
              MX_GPIO_Set(0);
              delay_ms(60);
          }
          else
          {
              MX_GPIO_Set(1);
              HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET);
              delay_ms(60);
  
              MX_GPIO_Set(0);
          }
  </code></pre>
  
  <p>it is write one bit data.</p>
  
  <p>and for the read code </p>
  
  <pre><code>MX_GPIO_Set(1);
  
          HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET);
          delay_ms(2);
  
          MX_GPIO_Set(0);
          if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_1) == GPIO_PIN_SET)
          {
              value |= 1 &lt;&lt; i;
          }
          delay_ms(60);
  </code></pre>
  
  <p>the MX_GPIO_Set(1) means set the GPIO output</p>
  
  <p>where is wrong?</p>
  
  <p>please do not tell me use library or code in github.I want to write code myself so I can understand the ds18b20.</p>