This is great and wont block other code. Is there a simple example you can use with serial input like to time a question with interrupts such that respose = input('Enter answer: ') if response == None, print('Fail!') but based on a timer?
I don't understand pin parsing. For example for pin 21 ,str(pin) is '21:IN:PULL_UP' then how come str(pin)[4:-1] returns pin number but not ':PULL_U' ....... Please explain
Try to play with this code and you will understand it :-) import machine led = machine.Pin(2, machine.Pin.OUT) sw = machine.Pin(0, machine.Pin.IN) def handle_interrupt(pin): led.value(not led.value()) print("Original string: " + str(pin) + " Parsed string: " + str(pin)[4:-1])
Isn't there a problem with the parsing operation in the IRQ handler? As far as I understand it, you're not supposed to do anything that allocates memory. What about the str() conversion?
I have a question sir. I realized that the program only runs when I connect the COM port to the computer if I want to do a project on battery power, what should I do sir please answer a question that I am pondering.
@@TechToTinker Please can you explain more the code line : irq_pin = int(str(pin)[ 4 : -1]) is the number 4 detrmining the speed and what -1 presents ?
@Matthias Andreas, I haven't tried it before it says machine.disable_irq() which will disable all esps interrupts. Call machine.enable_irq() to re/enable interrupts. Refer to:docs.micropython.org/en/latest/library/machine.html
@@TechToTinker , hi and thank you yes this way i tried out but on ESP32 i get OSErrors. I will try it again. By the way please can you make a video about Socket Server with ESP32 and micropython?
@@TechToTinker também estou fazendo vídeos sobre Micropython, estou aprendendo e ensinando também! Compartilhei o seu vídeo com os meus amigos! Parabéns!!! Abraços...
@@TechToTinker são vídeos bem humildes, para pessoas que apenas conhecem o idioma português. Tthese are very humble videos, for people who only know the Portuguese language. My playlist: ua-cam.com/play/PLCcdteC1rwSFvJnUoe0DfORHv4p_1EFps.html
@Professor Marcos Carnevali you've got a lot of MicroPython tuts there. Only problem is I can't understand Portuguese :). Anyways I love knowing other people doing similar things as I doing.
Nice tutorial. Very clearly explained. I like the clarity of your engineering.
Hi, Im happy to hear that. Thank you.
Thank you sir, this helped me to start with microPython and improve my CV 🙏🙏
This is great and wont block other code. Is there a simple example you can use with serial input like to time a question with interrupts such that respose = input('Enter answer: ') if response == None, print('Fail!') but based on a timer?
Great video !
@Karl Ivares, thank you.
I don't understand pin parsing. For example for pin 21 ,str(pin) is '21:IN:PULL_UP' then how come str(pin)[4:-1] returns pin number but not ':PULL_U'
.......
Please explain
me too. Don't understand this part.
Try to play with this code and you will understand it :-)
import machine
led = machine.Pin(2, machine.Pin.OUT)
sw = machine.Pin(0, machine.Pin.IN)
def handle_interrupt(pin):
led.value(not led.value())
print("Original string: " + str(pin) + " Parsed string: " + str(pin)[4:-1])
print("Press BOOT button
")
sw.irq(trigger=machine.Pin.IRQ_FALLING, handler=handle_interrupt)
very easy to understand weldone
Hi @Unique Food Machinery ltd, I am glad that you like it. Thank you.
Isn't there a problem with the parsing operation in the IRQ handler? As far as I understand it, you're not supposed to do anything that allocates memory. What about the str() conversion?
SIr, how can I disable OTA memory in my esp32E by using Thonny. I need more memory
I am coming from JavaScript background. This interrupt callback makes me feel at home.
What is the meaning of int(str(pin)[4:-1])
where does number 4 and - 1 come from? and what is the symbol : between mean?
Great material, would you create a GUI, for instance in Livy to control a motor? Thanks for the video
Hi @NesbyBone, thank you. As of now, I have no experience with Livy. Lets see in the future, I look into it.
I have a question sir.
I realized that the program only runs when I connect the COM port to the computer if I want to do a project on battery power, what should I do sir please answer a question that I am pondering.
Good explanation
Hi Jan, Im glad that you like it. Thank you.
@@TechToTinker Please can you explain more the code line : irq_pin = int(str(pin)[ 4 : -1]) is the number 4 detrmining the speed and what -1 presents ?
@@alzalame that line of code is use to parse the actual pin number of the interrupt.
Hello is it possible to enable and disable an interrupt?
@Matthias Andreas, I haven't tried it before it says machine.disable_irq() which will disable all esps interrupts. Call machine.enable_irq() to re/enable interrupts. Refer to:docs.micropython.org/en/latest/library/machine.html
@@TechToTinker , hi and thank you yes this way i tried out but on ESP32 i get OSErrors. I will try it again. By the way please can you make a video about Socket Server with ESP32 and micropython?
@@matthiasandreas6549 MicroPython web server: ua-cam.com/video/i8b-ZM2VeeU/v-deo.html
Esp32 web server: ua-cam.com/video/Lqn2J7LesCY/v-deo.html
Obrigado pelo vídeo! Like e Inscrito! Abraços...
You are welcome @Professor Marcos Carnevali. Cheers and thank you.
@@TechToTinker também estou fazendo vídeos sobre Micropython, estou aprendendo e ensinando também! Compartilhei o seu vídeo com os meus amigos! Parabéns!!! Abraços...
@@ProfessorMarcosCarnevali wow that's cool. Can you share your videos here? I would like to check it out. Thanks
@@TechToTinker são vídeos bem humildes, para pessoas que apenas conhecem o idioma português. Tthese are very humble videos, for people who only know the Portuguese language. My playlist: ua-cam.com/play/PLCcdteC1rwSFvJnUoe0DfORHv4p_1EFps.html
@Professor Marcos Carnevali you've got a lot of MicroPython tuts there. Only problem is I can't understand Portuguese :). Anyways I love knowing other people doing similar things as I doing.
Bro.meaning of led.value(not led.value())
Bro please reply
@@prakashkalvin7678 toggle the status of the led
if it's ON then turn it off
it it's OFF then turn it on.