Search found 16 matches

by mehdi_ziyaei
Sat Jul 06, 2019 2:37 pm
Forum: ESP8266 boards
Topic: [solved]Run two functions together
Replies: 6
Views: 4116

Re: [solved]Run two functions together

yes.worked .it's ok .tnx
by mehdi_ziyaei
Fri Jul 05, 2019 2:31 pm
Forum: ESP8266 boards
Topic: [solved]Run two functions together
Replies: 6
Views: 4116

Re: [solved]Run two functions together

like this ? import network import machine import utime import os import re import socket import sys from machine import Pin num_knock = 0 flag = 0 pin_door = Pin(0, Pin.OUT) def show_log(): file = open("log.text","r") print(file.read()) file.close() return def log_write (log_event): file = open ("lo...
by mehdi_ziyaei
Thu Jul 04, 2019 7:42 pm
Forum: ESP8266 boards
Topic: [solved]Run two functions together
Replies: 6
Views: 4116

Re: Run two functions together

I read this post several times. But I do not know how to use it. I can not implement.
by mehdi_ziyaei
Wed Jul 03, 2019 5:35 pm
Forum: ESP8266 boards
Topic: [solved]Run two functions together
Replies: 6
Views: 4116

[solved]Run two functions together

hi i want to run two functions together. 1)function >> socket >> show web page 2)function >> main >> off/on led / chk ... When the socket is active, I can not do it Both of my functions do different things. My socket displays a site. My main function does other activities. How do run both functions ...
by mehdi_ziyaei
Tue Jun 04, 2019 6:28 pm
Forum: Programs, Libraries and Tools
Topic: how run IRQ() IN IRQ()
Replies: 12
Views: 6181

Re: how run IRQ() IN IRQ()

import network import machine import utime import os import re from machine import Pin num_kenok = 0 def main(): starter= Pin(5, Pin.IN) while True: if starter.value()==1: print("enter password fun") led_on_off(3,600) p5 = Pin(5, Pin.IN) door_password="" for i in range(5): global num_kenok num_keno...
by mehdi_ziyaei
Tue Jun 04, 2019 2:25 pm
Forum: Programs, Libraries and Tools
Topic: how run IRQ() IN IRQ()
Replies: 12
Views: 6181

Re: how run IRQ() IN IRQ()

like this ???? def new_enter_password(): door_password="" knock_count = 0 from machine import Pin p5 = Pin(5, Pin.IN) for i in range(5): knock_count = 0 print("range %i"%i) chk_time = utime.time() + 10 while utime.time() <= chk_time: if p5.value()==1: knock_count += 1 print(knock_count) door_passwor...
by mehdi_ziyaei
Tue Jun 04, 2019 1:04 am
Forum: Programs, Libraries and Tools
Topic: how run IRQ() IN IRQ()
Replies: 12
Views: 6181

Re: how run IRQ() IN IRQ()

I worked on it for 24 hours. I tried different ways. I think this is the best way. How do I fix it? I started micropython in about a month and I do not have enough information. how use flag for my app?? when one irq run by knock , secend irq not work. i use pin_starter= Pin(5 ,Pin.IN ,handler = ente...
by mehdi_ziyaei
Mon Jun 03, 2019 12:18 am
Forum: Programs, Libraries and Tools
Topic: how run IRQ() IN IRQ()
Replies: 12
Views: 6181

Re: IRQ() IN IRQ()

by one knock must run enter_password() And get the password from the user by 5 loop .every one loop give 1 or 2 or ...or 9 knock . for ex: 1knock >> run app >> run enter_password() for i range 4 >> 5 loop loop 1 >>1knock >>my pass >> 1 loop 2 >> 7knock >>my pass >> 17 loop3 >> 4knock >>my pass >> 17...
by mehdi_ziyaei
Sun Jun 02, 2019 11:56 pm
Forum: Programs, Libraries and Tools
Topic: how run IRQ() IN IRQ()
Replies: 12
Views: 6181

Re: IRQ() IN IRQ()

num_knock = 0 def main(): while True: P5 = Pin(5, Pin.IN) P5.irq(trigger=Pin.IRQ_RISING , handler=enter_password() ) //ONE IRQ :!: def enter_password(P): print("enter password starting") p5 = Pin(5, Pin.IN) door_password="" for i in range(5): global num_knock num_knock = 0 chk_time = utime.time() +...
by mehdi_ziyaei
Sun Jun 02, 2019 11:48 pm
Forum: Programs, Libraries and Tools
Topic: how run IRQ() IN IRQ()
Replies: 12
Views: 6181

Re: IRQ() IN IRQ()

Hi. I can not speak English well.
I want the device to be in standby mode and run enter_password() function by knock.
by one knock ,enter_password() starting .after finish go to standby mode and wait for new knock to run again enter_password() .