title: how to make a counter inside a loop in python 3?
body: <p>I'm working on PIR sensor in order to detect the movement of human beings.  Here is below the code that currently I am using and I just need to make a counter inside the loop in order to count the # of movements. Thanks in advance!! </p>
  
  <pre><code>import RPi.GPIO as GPIO
  import time
  GPIO.setwarnings(False)
  GPIO.setmode(GPIO.BOARD)
  GPIO.setup(11, GPIO.IN)    # PIR motion sensor
  GPIO.setup(3, GPIO.OUT)    #LED output pin
  while True:
      i=GPIO.input(11)
      if i==0:               #sensor is LOW
          print "Not Occupied",i
          GPIO.output(3, 0)  #Turn OFF LED
          time.sleep(0.1)
      elif i==1:             # sensor is HIGH
          print "Occupied",i
          GPIO.output(3, 1)  #Turn ON LED
          time.sleep(0.1)
  </code></pre>