May-23-2018, 08:31 PM
I followed killerex'es suggestion and made base.py
When i call keycheck.status i get the following response:
As you will probably have noticed i am very much a novice, but i'll learn.
is there a site where i can learn about those situation?
#!/bin/python # baseprogram; calls the function status from key_check.py import sys import os import time from key_check import status while True: on_or_off=status print (on_or_off) time.sleep(3)and key_check.py that containes the function 'status'
#!/bin/python #import RPi.GPIO as GPIO import time import os #GPIO.setup(22, GPIO.IN) def status(): foo = 5 # Lees de status van de GPIO pin uit. if (foo) == 4: #Schakelaar is AAN. key = 'ON' else: #Schakelaar is UIT. key = 'OFF' return (key) datum = (time.strftime('%d/%m/%Y')) #print(datum) #keystat = status() #print (keystat) def _test(): pass if __name__ == '__main__': # This part runs only when this script is the main script, not when imported from other _test()Running key_check on its own is OK.
When i call keycheck.status i get the following response:
Output:Python 3.6.4
>>> %Run base.py
<function status at 0x037E4E40>
<function status at 0x037E4E40>
KeyboardInterrupt: Forced reset
>>>
Any ideas about this?As you will probably have noticed i am very much a novice, but i'll learn.
is there a site where i can learn about those situation?