February 7, 2015
TWBR = bit rate
TWINT interrupt flag
TWEA enable acknowledge
TWSTA set start
TWSTO set stop
TWWC collision detected
TWEN twi enable
TWIE interrupt enable
TWPS (1:0) prescaler
TWDR = data register
SCL freq = CPU clock / (16 + 2 * TWBR * 4TWPS).
TWBR must be at least 10 for master mode.
SCL freq must be 100Khz or less.
CPU clock is 8 Mhz.
Denominator must be larger than 80 = 16 + 64, TWBR * 4TWPS must be greater than or equal to 32.
TWBR=10-31, TWPS=1 (40-124)
TWBR=32-255, TWPS=0 (32-255)
At 100kHz, send data at about 10kB/s. 80 characters requires 8ms.
Master-side state changes for writing a data byte to a slave:
TWCR = _BV(TWSTA)|_BV(TWINT)|_BV(TWEN)|_BV(TWIE)
Receive interrupt, check TWSR for successful start.
TWDR = SLA+W (W=0, R=1: SLA = 0x50 for Newhaven serial display
TWCR = _BV(TWINT)|_BV(TWEN)|_BV(TWIE)
Receive interrupt, check TWSR for successful address.
TWDR = data
TWCR = _BV(TWINT)|_BV(TWEN)|_BV(TWIE)
Receive interrupt, check TWSR for successful data.
TWCR = _BV(TWSTO)|_BV(TWINT)|_BV(TWEN)|_BV(TWIE)
Receive interrupt, check TWSR for successful stop. Read the rest of this entry »
January 15, 2015
First, we start with someone who is doing something that requires two hands on the smartphone, surely not texting, that would be illegal:
Notice how the Prudent Cyclist is none too eager to pass this person after noticing their unpredictable and erratic driving.
Next, we have someone piloting their barge down the Broadway Ship Channel, and they have inadvertently strayed outside the marked boundaries. Remember boaters, “Red, Right, Return”.
January 14, 2015
With studded tires, there’s not much to it. If it’s flat, you go:
Not obvious in this video is that I was getting plenty of rear wheel spin after I passed the pedestrian. I was just in a mood to scratch the ice, so I did. It’s not at all clear that I needed the studs here, though the pedestrian seemed to think it was slippery.
If it’s a hill, sometimes you can’t go. The rear wheel just spins, so you stop. Careful putting your feet down, too. It’s important to put the better tire on the front, so that “can’t go” is what happens:
Apologies for the heavy breathing; I was in a hurry to get home in the first, and climbing a 10% grade in the second.
January 10, 2015
It’s a little thing, but sometimes people wonder whether electric cars are more of a hazard to bicycles because they are so quiet. At low speeds, yes they are quiet, but at any reasonable speed (i.e., what you might expect to encounter outside of a traffic jam) their tires are plenty noisy. Here’s a sample (taken on a windy day, too — on the other hand wet roads are a little noisier):
Yes, one of those cars is electric.
December 14, 2014
“Your recent Trac powered by Bitnami launch failed. Your requested instance type (m1.small) is not supported in your requested Availability Zone (us-east-1e). Please retry your request by not specifying an Availability Zone or choosing us-east-1b, us-east-1a, us-east-1c.”
And how, pray tell, is “retry my request” accomplished? I probed various links, none of them took me to the place where I launched from, do I need to delete this one first, or is it already dead? If I make the obvious mistake here, will it cost me money? (I don’t think it will, but there’s a gap between “don’t think it will” and “won’t”.)
And why did it let me make this request in the first place, if it was doomed to failure (I think this was all specified on an early page, why was this combo shown to me, never mind that it was chosen as the default)? And why isn’t there a help/feedback button on this page where I need help or want to give feedback?
Fortunately, I have a blog. Always remember, this is not just about public shaming of (other) bozos, this is doing them a favor by pointing out the upside potential in their products. People who care about improving their software will make it as easy as possible to file bugs, and will make it as easy as possible for the filed bugs to be informative to whoever has to deal with them.
November 11, 2014
I got a GoPro as a treat/present. Other people seem to use theirs to show how dangerous drivers can be (especially in London, what is it with London?), I figured it would be more constructive to show how things can work. And yes, sometimes drivers can be clueless and/or dangerous, that’s just the way our world works right now, but a lot of that risk can be managed.
Here are little bits and pieces of my commute, showing how various bits of safety advice play out in the real world. This is “non-legal” because so often the safety advice to cyclists starts and mostly ends with “obey traffic laws” as if that were either necessary or sufficient (and as if that were actually standard practice for drivers). The laws that people tell you to obey were not designed with bicyle safety in mind — sometimes they help, sometimes they don’t. They’re definitely not enough. The examples below illustrate rules I actually use.
My background is “long-term recovering Effective Cyclist” — I learned all the moves for riding in traffic, and I’m relatively comfortable doing that, but I think that overall that’s not going to work for most people. If it weren’t so necessary to “share” the road with drivers so often, this advice would be much less useful — but we’re stuck with crappy shared roads, so maybe this will be helpful to you. I recorded several commuting videos without specifically intending to demonstrate anything and then reviewed them looking for examples, so this is more or less rules-as-practiced, warts and all (I think I ride too close to the door zone, at least it sure looks like it on the video).
Without further explanation: Read the rest of this entry »