Search found 5140 matches

by pythoncoder
Wed Oct 29, 2014 5:49 pm
Forum: MicroPython pyboard
Topic: pyboard pins quick reference
Replies: 4
Views: 3121

Re: pyboard pins quick reference

Excellent!

Regards, Pete
by pythoncoder
Wed Oct 29, 2014 12:00 pm
Forum: General Discussion and Questions
Topic: keeping REPL alive
Replies: 6
Views: 4170

Re: keeping REPL alive

You might be interested in this code which works fine on the MicroPython board class Encoder(object): def __init__(self, pin_x, pin_y, reverse, scale): self.reverse = reverse self.scale = scale self.forward = True self.pin_x = pin_x self.pin_y = pin_y self._pos = 0 self.x_interrupt = pyb.ExtInt(pin_...
by pythoncoder
Fri Oct 24, 2014 6:09 am
Forum: General Discussion and Questions
Topic: Inline Assembler Instruction Set
Replies: 1
Views: 1622

Re: Inline Assembler Instruction Set

I found this useful http://wiki.micropython.org/platforms/boards/pyboard/assembler It's worth knowing how Micropython stores and passes integers to Assembler functions. The later part of this thread explains. http://forum.micropython.org/viewtopic.php?f=2&t=286 Good luck. It's incredibly fast... Reg...
by pythoncoder
Thu Oct 23, 2014 8:09 am
Forum: Hardware Projects
Topic: Module for MPU9150
Replies: 54
Views: 30829

Re: Module for MPU9150

@Turbinenreiter Alas you've broken it ;) To conform with the change you made to the read() method line 70 should read: self.chip_id = int(unp('>h', self._read(1, 0x75, self.mpu_addr))[0]) I suggest you also remove the devaddr default from read() and write() so: def _read(self, count, memaddr, devadd...
by pythoncoder
Thu Oct 23, 2014 6:04 am
Forum: Hardware Projects
Topic: Module for MPU9150
Replies: 54
Views: 30829

Re: Module for MPU9150

Incidentally I did a lot of testing of my project yesterday and never saw a timeout or I2C bus crash. Previously I would have encountered numerous instances so I'm convinced that disabling interrupts for the duration of I2C access has fixed the problem. I wish I knew why, but life's too short... Reg...
by pythoncoder
Thu Oct 23, 2014 6:00 am
Forum: Hardware Projects
Topic: Module for MPU9150
Replies: 54
Views: 30829

Re: Module for MPU9150

@Turbinenreiter Thanks for the pointers re github - it's very unfamilar territory for me. I'll probably delete the fork and create a new one when I have some code to offer as that seems a simple concept for a n00b like myself. Re closures. The requirement is for a function-like obect which retains s...
by pythoncoder
Wed Oct 22, 2014 2:43 pm
Forum: Hardware Projects
Topic: Module for MPU9150
Replies: 54
Views: 30829

Re: Module for MPU9150

@Turbinenreiter If you're happy with my efforts to date and want some help, I'm prpared to code up the changes to the manetometer. I could have some code in about a week. 1. Enable non-blocking reads. 2. Read and implement the factory set of compensation data. I have a slight preference for using a ...
by pythoncoder
Wed Oct 22, 2014 7:57 am
Forum: General Discussion and Questions
Topic: Drive counter with external clock source
Replies: 8
Views: 6322

Re: Drive counter with external clock source

I'm also starting to think about putting together a repository of SFR hacks
That would be very useful and educational.

Regards, Pete
by pythoncoder
Wed Oct 22, 2014 7:15 am
Forum: General Discussion and Questions
Topic: Playing with Interrupts
Replies: 21
Views: 17415

Re: Playing with Interrupts

I agree. Interrupts are vital where a rapid response to an event is paramount, but because they involve true concurrency there are a number of gonk traps lurking in their use. Threaded code, using cooperative mult-tasking, avoids most of these and (if used properly) is fast enough for devices suppor...
by pythoncoder
Wed Oct 22, 2014 7:01 am
Forum: Hardware Projects
Topic: Module for MPU9150
Replies: 54
Views: 30829

Re: Module for MPU9150

It also allows for nested exception handling. To be specific, we have an MPU9150 class with read() and write() methods: these use I2C and raise a custom exception MPU9150_Exception if the I2C read fails (ideally this would come from the I2C code itself). The following method allows the I2C error to ...