title: Why is there random unwanted delay on my sense hat? Is it an issue with my code or the speed of my raspberry pi?
body: <p>Why is there random unwanted delay on my sense hat? Is it an issue with my code or the speed of my raspberry pi?</p>
  <p>The code:</p>
  <pre><code>from sense_hat import SenseHat
  import time
  from random import randint
  from time import sleep
  
  sense = SenseHat()
  sense.low_light = False
  sense.clear()
  
  white = (255,255,255)
  black = (0,0,0)
  
  x = 0
  y = 0
  xspeed = 0
  yspeed = 0
          
  while True:
      
      
      pitch = sense.get_orientation()['pitch']
      roll = sense.get_orientation()['roll']
      
      if 270 &lt; pitch &lt; 345 and x &lt; 7:
          sense.set_pixel(x,y,black)
          x+=1
      if 45 &lt; pitch &lt; 90 and x &gt; 0:
          sense.set_pixel(x,y,black)
          x-=1
      if 45 &lt; roll &lt; 90 and y &lt; 7:
          sense.set_pixel(x,y,black)
          y+=1
      if 270 &lt; roll &lt; 345 and y &gt; 0:
          sense.set_pixel(x,y,black)
          y-=1
          
      sense.set_pixel(x,y,white)
      
      if 300 &lt; pitch &lt; 350:
          delay = (pitch-300)/200
      elif 300 &lt; roll &lt; 350:
          delay = (roll-300)/200
      elif 15 &lt; pitch &lt; 45:
          delay = (pitch-310)/-200
      elif 15 &lt; roll &lt; 45:
          delay = (roll-310)/-200
      else:
          delay = 0
      time.sleep(delay)
  
  </code></pre>
  <p>When I tip the hat through the 15-45 axis's, then it plays up. When I comment that section out, the code runs cleanly. I was wondering if there is an issue with the code or it was simply my pi being slow.</p>