Photo sensitive control - 2284238y/Team-1-Fernando-Martinez-YI-YI-LianSheng-Liu- GitHub Wiki

About Photo sensitive control, the light sensor should be controlled by using the GPIO pin on the Raspberry Pi.

The photo sensitive control system block diagram is below:

(1). Firstly, start the photosensitive control module and display "Photo Transistor started...", and initialize the count with count, defined as 0:

print("Photo Transistor started...")
  stable = 0
  count=0

(2). Secondly, judge the input signal received by GPIO, GPIO should input low-level signal. The program code is as follows:

 inp = GPIO.input(PIN)==GPIO.LOW
    if(not inp):
        stable+=1
    else:
        stable-=1

(3). Next, if stable > 10,the program enters the increment buffer and check the buffer, if the buffer is greater than 30,curtains rise; if the stable < -10, the program enters the decrement buffer and check the buffer, if the buffer is less than 30,curtain down.

    if(stable>10 and not up):
        go_up()
        up = True
        down = False
        stable=0
        count=0
    elif(stable<-10 and not down):
        go_down()
        down = True
        up = False
        stable=0
        count
    else:
        if(count>30):
            stable = 0
            count = 0

The whole code of this module can be found in the code.

For information on how this section works, refer to the System Flow Chart in the README.

There are two youtube links about my photo sensitive control test: https://youtu.be/SZ_Wty5v22Y

https://youtu.be/Fl68NOJqWSA