title: AVR C - Why inverting values?
body: <p>I have extremly stupid question, but I wasn't able to find answer to it. I am starting AVR programming and I have one question, regarding code example I've found.</p>
  
  <pre><code>int main(void)
  {
      DDRA = 0xFF; // Setting all port A pins for output
  
  for(;;)
  {
      PORTA = ~0x21; // Why ~ if we want PA0 and PA5 to be High?
      _delay_ms(10000);
  }
  </code></pre>
  
  <p>So why we need to invert 0x21? It should have High on PA0 and PA5, but if we are inverting it, shouldn't it be the opposite (all High except for PA0 and PA5)?</p>
  
  <p>I have tried to search, but I haven't found any explanation. Thank you!</p>