title: convert code from arduino to python
body: <p>could someone help me to translate this arduino code to python code?</p>
  
  <pre><code>#define BUFFLEN 3
  
  byte buffer[] = { 0x05, 0x0D, 0x02, 0xFF, 0x10, 0xAA }
  
  for (byte i=0; i &lt; BUFFLEN; i++) {
      val = analogRead(A0);
      val = constrain(val,0,1023);
      buffer[i*2] = (byte)(i&lt;&lt;2) | highByte(val);
      buffer[i*2+1] = lowByte(val);
  }
  </code></pre>
  
  <p>Thanks</p>