Search found 3821 matches

by dhylands
Wed Aug 13, 2014 2:50 pm
Forum: General Discussion and Questions
Topic: Trying to use timers to avoid a blocking loop
Replies: 15
Views: 29756

Re: Trying to use timers to avoid a blocking loop

Just some random ramblings based on my own experience. The way a RTOS (real-time OS) works is that the highest priority thread runs until it blocks, or is preempted by an even higher priority thread. Threads of equal priority run in a round-robin fashion determined by the time slice. If you specifie...
by dhylands
Wed Aug 13, 2014 2:35 pm
Forum: General Discussion and Questions
Topic: Question for micropython devs: unimplemented features
Replies: 5
Views: 5582

Re: Question for micropython devs: unimplemented features

I wrote most of the format code and I didn't realize you could even do recursive stuff :shock:

I was wondering how to specify a width as an argument using format (You would use %*.*s using modulo.

So I'll probably take a stab at fixing the format one.
by dhylands
Wed Aug 13, 2014 1:52 pm
Forum: MicroPython pyboard
Topic: Controlling the output power of a pin (dimming external LED)
Replies: 15
Views: 15331

Re: Controlling the output power of a pin (dimming external

There are led driver chips that use frequencies like 1.6MHz ans 2MHz so I'm going to assume its fine. The change in power usage is probably negligible, but you'd have to measure to be sure.
by dhylands
Wed Aug 13, 2014 7:08 am
Forum: Programs, Libraries and Tools
Topic: A simple shell for pyboard
Replies: 45
Views: 47930

Re: A simple shell for pyboard

There is already 8 lines of history that you can retrieve using the up-arrow (at least under linux).

If your terminal is sending the ANSI escape sequence for the up arrow (which is ESC [ A) then you should be getting history displayed.
by dhylands
Wed Aug 13, 2014 6:52 am
Forum: MicroPython pyboard
Topic: Controlling the output power of a pin (dimming external LED)
Replies: 15
Views: 15331

Re: Controlling the output power of a pin (dimming external

Sorry about the mis-information about freq=5. It turns out that one of the factors influencing the frequency of the timer is determined by the value of the PSC register. For timers, 2, 3, 4, 5, 6, 7, 12, 13, and 14 it works out to 84 MHz. For timers 1, 8, 9, 10, 11 it works out to 168 MHz (I think I...
by dhylands
Wed Aug 13, 2014 3:45 am
Forum: MicroPython pyboard
Topic: Controlling the output power of a pin (dimming external LED)
Replies: 15
Views: 15331

Re: Controlling the output power of a pin (dimming external

There are 2 things that go together, frequency and duty cycle.

If you send a 50% duty cycle at 1000 cycles per second or 10 cycles per second you'll get about 50% brightness.

As you get slower you can see the frequency visibly.
by dhylands
Wed Aug 13, 2014 2:44 am
Forum: MicroPython pyboard
Topic: Controlling the output power of a pin (dimming external LED)
Replies: 15
Views: 15331

Re: Controlling the output power of a pin (dimming external

Try changing freq=5 to a higher number (perhaps 100)
by dhylands
Tue Aug 12, 2014 10:29 pm
Forum: MicroPython pyboard
Topic: Controlling the output power of a pin (dimming external LED)
Replies: 15
Views: 15331

Re: Controlling the output power of a pin (dimming external

And I thought I should mention, that the STM32F405 datasheet says that the max current for a single pin is 25 mA.

So if you're going to be driving more than a single LED, you should really consider using a transistor or a MOSFET to switch the LEDs on and off.
by dhylands
Tue Aug 12, 2014 8:59 pm
Forum: MicroPython pyboard
Topic: Controlling the output power of a pin (dimming external LED)
Replies: 15
Views: 15331

Re: Controlling the output power of a pin (dimming external

The normal way that control brightness of an LED is to use PWM.

PWM isn't properly supported on the pyboard, but this thread has a way to do it:
http://forum.micropython.org/viewtopic. ... t=210#p967
Also see here: http://forum.micropython.org/viewtopic. ... t=PWM#p982
by dhylands
Tue Aug 12, 2014 2:42 pm
Forum: General Discussion and Questions
Topic: Trying to use timers to avoid a blocking loop
Replies: 15
Views: 29756

Re: Trying to use timers to avoid a blocking loop

Most of my embedded projects involve threading. In essence one thread might read values from hardware, another might display results, and a third would respond to user interactions. When running under an OS I normally use the threading library, but I suspect this is too heavyweight to be ported to ...