Search found 38 matches

by MorseIot
Tue Jul 24, 2018 1:51 am
Forum: ESP8266 boards
Topic: How can I reuse Timer.ONE_SHOT in code.
Replies: 2
Views: 1895

How can I reuse Timer.ONE_SHOT in code.

How can I reuse Timer.ONE_SHOT in code. Example: def actionStart (self):        self.timer = Timer (-1)        self.timer.init (period = 1000, mode = Timer.ONE_SHOT, callback = self.actionStart) def actionStart (self, * args)         print ('Working ...')         self.timer.init (period = 1000, mode...
by MorseIot
Sun Jul 15, 2018 9:13 pm
Forum: ESP8266 boards
Topic: MemoryError: memory allocation failed, allocating %u bytes
Replies: 6
Views: 7238

Re: MemoryError: memory allocation failed, allocating %u bytes

Thanks Peter Hinch, iam read the doc.

I need help using mpy-cross or use frozen bytecode
by MorseIot
Sat Jul 14, 2018 10:37 pm
Forum: ESP8266 boards
Topic: MemoryError: memory allocation failed, allocating %u bytes
Replies: 6
Views: 7238

MemoryError: memory allocation failed, allocating %u bytes

When you try to run file (test.py) with size of 18447 bytes, the error is generated:

Code: Select all

MemoryError: memory allocation failed, allocating %u bytes
When I split the same, it runs correctly. Is there any limitation of file size (py), or command that can bypass this situation
by MorseIot
Sun Jul 08, 2018 3:29 am
Forum: General Discussion and Questions
Topic: urequests delay
Replies: 0
Views: 1188

urequests delay

When using the code example below: import time import network import urequests def setNetworkConfig(ssid, pwd): wlan = network.WLAN(network.STA_IF) if not wlan.isconnected(): print('connecting to network...') wlan.active(True) wlan.connect(ssid, pwd) while not wlan.isconnected(): pass print('network...
by MorseIot
Fri Jun 29, 2018 2:06 pm
Forum: ESP8266 boards
Topic: Two timers in the same project
Replies: 2
Views: 2011

Re: Two timers in the same project

Thanks. :D :D Example: timer0 = machine.Timer(0) # create a timer object timer0.init(period=1000, mode=machine.Timer.PERIODIC, callback=self.callback0) timer1 = machine.Timer(1) # create a timer object timer1.init(period=1000, mode=machine.Timer.PERIODIC, callback=self.callback1)
by MorseIot
Fri Jun 29, 2018 12:40 am
Forum: ESP8266 boards
Topic: Two timers in the same project
Replies: 2
Views: 2011

Two timers in the same project

Can I use 2 Timer in my python project? Example I used: class foo:          def start (self):          timer = machine.Timer (0) # create a timer object          timer.init (period = 1000, mode = machine.Timer.PERIODIC, callback = lambda t: self.execute ())     def execute (self):          print ("T...