Search found 2805 matches

by pythoncoder
Tue Aug 21, 2018 8:51 am
Forum: The micro:bit
Topic: arm thumb2 assembly
Replies: 3
Views: 75

Re: arm thumb2 assembly

by pythoncoder
Tue Aug 21, 2018 8:27 am
Forum: Hardware Projects
Topic: LCD160CR firmware source code
Replies: 6
Views: 86

Re: LCD160CR firmware source code

The firmware author is

Dr. Thomas Spindler
ESG Workstation GmbH
Obere Gartenstr. 34
74632 Neuenstein
TEL: +49 7942 946058
FAX: +49 7942 946188
Ust-IdNr.: DE146278693
St.-Nr.: 76001/03930
Geschäftsführer: Dr. Thomas Spindler
Sitz der Gesellschaft 74632 Neuenstein
Registergericht: Stuttgart HRB 580565
by pythoncoder
Tue Aug 21, 2018 8:23 am
Forum: The micro:bit
Topic: Create read-only array in code memory, not RAM?
Replies: 5
Views: 89

Re: Create read-only array in code memory, not RAM?

The const() keyword applies only to integers (or expressions which can evaluate to integers at compile time). It is a signal to the MicroPython compiler which replaces the symbol with a number. This saves time by removing a variable access. It will also save RAM, provided another module doesn't impo...
by pythoncoder
Tue Aug 21, 2018 8:03 am
Forum: General Discussion and Questions
Topic: Missing py file
Replies: 2
Views: 35

Re: Missing py file

The module is frozen as bytecode: standard firmware builds include some modules compiled into the build. If you issue help('modules') you should see simple as part of the output. The failing line is addr = socket.getaddrinfo(self.server, self.port)[0][-1] I would check your server and port settings....
by pythoncoder
Tue Aug 21, 2018 7:45 am
Forum: General Discussion and Questions
Topic: Need some help how to distribute features between main.py and scripts on sd card
Replies: 13
Views: 175

Uused imports

Unused imports can easily creep into code, for example you might import time to test a function's execution time, then remove the test. So before releasing code I check for and remove unused imports. They waste RAM and make code that bit harder to follow. As for crashing hardware since the resource ...
by pythoncoder
Mon Aug 20, 2018 8:08 am
Forum: General Discussion and Questions
Topic: Need some help how to distribute features between main.py and scripts on sd card
Replies: 13
Views: 175

Re: Need some help how to distribute features between main.py and scripts on sd card

No. Have the module with the logging function run

Code: Select all

import os
This forum is to support MicroPython: users assume a knowledge of Python. Your queries are elementary ones about the Python language. I would advise you to learn the language using Python on a PC with a book or online course.
by pythoncoder
Sun Aug 19, 2018 8:22 am
Forum: General Discussion and Questions
Topic: Need some help how to distribute features between main.py and scripts on sd card
Replies: 13
Views: 175

Re: Need some help how to distribute features between main.py and scripts on sd card

@OutoftheBOTS_ For the benefit of the OP (@liudr) I would point out that reload is not natively supported but is provided by code in main.py. As to your workflow it depends on how you perform the edit/upload part of the cycle. I guess you are using the mass storage interface. This can be problematic...
by pythoncoder
Sun Aug 19, 2018 8:04 am
Forum: Drivers for External Components
Topic: SSD1306 OLED display: enhanced driver
Replies: 2
Views: 76

Re: SSD1306 OLED display: enhanced driver

Just ordered a Nokia display so I'll give it a try.
by pythoncoder
Sat Aug 18, 2018 10:18 am
Forum: Drivers for External Components
Topic: SSD1306 OLED display: enhanced driver
Replies: 2
Views: 76

SSD1306 OLED display: enhanced driver

Two years ago I wrote font_to_py.py : a utility for converting fonts to Python source. This enables fonts to be stored as frozen bytecode and used with minimal RAM allocation. To demonstrate it I wrote a very basic Writer class intended as a proof of concept. A number of people are using this as it ...
by pythoncoder
Sat Aug 18, 2018 8:46 am
Forum: General Discussion and Questions
Topic: Need some help how to distribute features between main.py and scripts on sd card
Replies: 13
Views: 175

Duck Typing

Python uses Duck Typing . It is normal to do things like: import machine i2c = machine.I2C(1) import my_module my_module.run(i2c) my_module only needs to import machine if "machine" appears in its sourcecode. The module can feely call I2C methods against the passed I2C instance: Python determines th...