I’m currently part way through a fantastic course on hardware design. It’s called Nand2Tetris and walks through building a simulated computer from the very simplest components (individual transistors) right through to a fully functioning computer. There’s a subreddit available if you want to chat with some fellow learners and a TED talk covering the courseRead more »

Remember when mainstream media channels used to act dumb and/or condescending round science? Stephen Colbert is among a growing cadre of broadcasters who gets it right. Here’s the best layman’s explanation of gravitational waves I’ve seen.

Lego Technic Power Function motors are nice and easy to hack for robotics projects – in large part because they come with a built in gearbox so you get nice amounts of torque at low speeds right out of the box. Here’s a quick breakdown of what you need to know. The tl;dr is thatRead more »

Here’s a nice little idea I saw somewhere a while ago and have just got round to making. It’s just an LED in series with a 470Ω resistor connected to a pair of 0.1″ pitch posts. Whenever you need to quickly check a signal on a breadboard you can just plug one of these babiesRead more »

Much as I’d love to have a proper oscilloscope I’m wise enough to know that spending a couple of hundred quid on a cheapo version is probably a bad idea. This is a tool that warrants some significant investment. Or alternatively pretty much none. I’ve just bought and built a little Jyetech DSO138 kit oscilloscopeRead more »

So if pointers are so great, why not only use pointers? For two reasons, both of which are consequences of the fact that pointers are a method of indirection. Indirection is, at heart, adding a step to the set of steps needed to get at the information you need. This makes the process of gettingRead more »

Because of C’s pass by value semantics, passing data into functions using parameters requires pushing and popping that data onto and off the stack, byte by byte. Using return values to pass data out of a function back to the callee also requires copying the data onto the stack. If you’re just passing or returningRead more »

So, as a result of some aberrant brain misfiring you’ve decided to start learning to code in C. You pretty quickly come across the idea of functions and your mind is blown. Then you try to write a function and all is not well. Not well at all. In fact things are looking a bitRead more »

Suppose you’re writing a function to double a given number. You might naively assume that this would be a reasonable solution: If you run it you’ll find number remains unchanged. This is, you might be surprised to discover, by design. It’s down to C’s pass by value semantics. Instead, use referential semantics as follows toRead more »

If you’ve run into the classic noob C programmer’s problem of “Why won’t my function update my variable?” then you might have resorted to using a global variable instead of passing the variable into the function as a parameter. Global variables allow ‘write access’ to number from both the caller and the callee, like this,Read more »

Next Page »