Variable wird nicht übergeben
Posted: Fri Apr 09, 2021 5:05 pm
I think I'm out of the wind somewhere.
How do I make the variable 'sendung' global so that it can be used everywhere ???
Code: Select all
import machine
from machine import Pin
import utime
#here I create a variable
sendung = 0
gesendet = machine.Pin(5)
def int_handler(pin):
sendung = 1
#everything is recognized correctly here and transmission is = 1
gesendet.irq(trigger=machine.Pin.IRQ_RISING, handler=int_handler)
while True:
utime.sleep(1)
#shipment is no longer 1 ????????
print(sendung)
if sendung == 1:
print(" hallo ")
sendung = 0
How do I make the variable 'sendung' global so that it can be used everywhere ???