Search found 24 matches

by Philosophix
Fri Jan 04, 2019 3:31 pm
Forum: MicroPython pyboard
Topic: PYBv1.1 V+ range
Replies: 7
Views: 4047

PYBv1.1 V+ range

Looking at http://micropython.org/resources/pybv11-pinout.jpg i see that I should be able to power the pyb directly from a tractor electrical system which is ~14 V when the tractor is running as the image says V+ can be 3.6-16 V. Is this correct? I've been using a 9 V regulator on my protoboard to f...
by Philosophix
Fri Jan 04, 2019 3:25 pm
Forum: MicroPython pyboard
Topic: Save data on power down
Replies: 14
Views: 8396

Re: Save data on power down

I was accidentally looking at the PYB1.0 picture in the quick reference where there is no VBACK. I have PYB1.1 so after getting the correct picture I added a CR2032 to VBACK and which is working fine with the code you provided. I still can't find any documentation on the stm-module.
by Philosophix
Fri Jan 04, 2019 7:14 am
Forum: MicroPython pyboard
Topic: Is there a code level reason why my interrupt is not getting called?
Replies: 9
Views: 4793

Re: Is there a code level reason why my interrupt is not getting called?

For future reference: ext.enable() and while True: pass were not needed to make the interrupt work. Also the interrupt callback function axle_pulse_detected(line) will only be: def axle_pulse_detected(line): global axle_pulse_counter axle_pulse_counter += 1 The lcd printouts were just for debugging ...
by Philosophix
Fri Jan 04, 2019 6:55 am
Forum: MicroPython pyboard
Topic: Is there a code level reason why my interrupt is not getting called?
Replies: 9
Views: 4793

Re: Is there a code level reason why my interrupt is not getting called?

Adding

Code: Select all

global axle_pulse_counter
fixed the problem as all variables are assumed to be local in a python function. You can access a global variable without the explicit global declaration, but you can't modify it without it. You live, you learn. Thanx a million Roberthh!!
by Philosophix
Fri Jan 04, 2019 5:24 am
Forum: MicroPython pyboard
Topic: Save data on power down
Replies: 14
Views: 8396

Re: Save data on power down

Ok. RTC running is not such a big deal. About VBAT: i found this https://store.micropython.org/pyb-features where it says it should be 3.6-16 V?? I was already planning on using a 9 V battery as I happened to have a housing for that at home. I can't find any documentation on the stm-module you menti...
by Philosophix
Thu Jan 03, 2019 6:00 pm
Forum: MicroPython pyboard
Topic: Is there a code level reason why my interrupt is not getting called?
Replies: 9
Views: 4793

Re: Is there a code level reason why my interrupt is not getting called?

Tested both of your suggestions, but no luck. I think (though am not sure) that the infinite while loop at the end is not needed as the interrupt callback is already set and should fire regardless.
by Philosophix
Thu Jan 03, 2019 4:52 pm
Forum: MicroPython pyboard
Topic: Is there a code level reason why my interrupt is not getting called?
Replies: 9
Views: 4793

Is there a code level reason why my interrupt is not getting called?

import os import pyb import lcd160cr from pyb import Pin, ExtInt lcd = lcd160cr.LCD160CR('Y') lcd.set_orient(lcd160cr.LANDSCAPE_UPSIDEDOWN) lcd.set_font(2, scale=2) lcd.set_text_color(lcd.rgb(0, 0, 0), lcd.rgb(255, 255, 255)) def clear_lcd(): lcd.set_pen(1, lcd.rgb(255, 255, 255)) lcd.erase() axle_...
by Philosophix
Thu Jan 03, 2019 4:49 pm
Forum: MicroPython pyboard
Topic: Run a function periodically
Replies: 4
Views: 3371

Re: Run a function periodically

In that case the cose seems reasonable. Is it not working?
by Philosophix
Thu Jan 03, 2019 3:17 pm
Forum: MicroPython pyboard
Topic: Run a function periodically
Replies: 4
Views: 3371

Re: Run a function periodically

You don't need a while True -loop if you only want to do something when the timer fires. You can have all your conditionals there. Why are you declaring a global master_timer in two places? Just put the master_timer = 0 at the top of the file outside the functions so you can then use it in the funct...
by Philosophix
Thu Jan 03, 2019 1:26 pm
Forum: MicroPython pyboard
Topic: How do I access the static backup RAM?
Replies: 0
Views: 1788

How do I access the static backup RAM?

I need to keep a python integer in backup RAM so it's not lost on power down. How do I access that? The stm-library has maybe something to do with it, but I can't find any docs on it.