Python: converting a string representing an hexadecimal integer representation into an int variable

Submitted by fabio on Wed, 2010-08-11 18:27.

Recently I had the need to convert a string containing the hexadecimal representation of an integer into an integer variable.

Eg, with something like FFAA, create an integer variable with the value of 65450.

In some programming languages there is an unhex() function but not in python.

In order to do so you'll need to use int(). If called with two arguments, int() expects the first to be a string representing a number in some base and the second to be the base.

ermannofalco.com: a photographer portfolio website built with Drupal

Submitted by fabio on Tue, 2010-07-27 15:18.

In this post I'd like to present you my latest website: Ermanno Falco - Fotografo di Torino (in Italian).

ermannofalco.com screenshot

PWM and Arduino: fading an LED and playing melodies on a Piezo Speaker

Submitted by fabio on Mon, 2010-07-26 12:49.

In the past blog posts, we already saw how to read and write digital signals on the Digital Input Output pins of the Arduino. We also used the analog reading capabilities of Arduino to read values from variable resistance components such as potentiometers, thermistors, or LDRs.

We still don't know anything about how to produce an Analog Output signal with Arduino. In this post, will cover it.

Serial communication with Arduino and Processing: simple examples and an Arduino based gamepad interfacing with Processing

Last updated on Mon, 2010-07-26 13:42. Originally submitted by fabio on 2010-07-24 18:46.

In this blog post, I'll describe Arduino serial communication capabilities. I'll provide simple examples of Arduino programs which use the serial interface to communicate with other devices, mostly a PC. I'll show you how to read and write data on a Serial interface and we'll also interface Arduino with a simple Processing program, a super simple video game.

Diodes, Transistors and Optocouplers: what they are, some theory and simple usages examples with Arduino

Submitted by fabio on Thu, 2010-07-22 10:39.

In this post I'll experience with three kind of components available in the Arduino Base Workshop KIT: diodes (model 1n4007), transistors (models BC547 Transistor and MOS Irf540) and optocouplers (model 4N35). I'll briefly describe them and we'll see some simple examples of circuits built upon an Arduino Duemilanove board which make use of them.

Pushbuttons and tilt sensors/switches: how they work and some Arduino usage examples

Last updated on Wed, 2010-07-21 06:35. Originally submitted by fabio on 2010-06-29 00:06.

In this blog post I describe two switching components available in the Arduino Base Workshop KIT: pushbuttons and tilt sensors. I'll briefly describe how they works, what's the theory behind them and how to create some simple circuits to use them with Arduino.

Variable resistance components: Thermistors and Light dependent resistors (LDR) on a Arduino simple circuit

Last updated on Wed, 2010-07-14 01:34. Originally submitted by fabio on 2010-06-14 00:19.

In the past blog post we used a potentiometer to provide a user variable voltage to one of the Analog In pin. We then used the value read from the Analog In pin to set the blinking delay of an LED. This resulted in the LED which was blinking faster and slower depending on how the potentiometer was set.

Potentiometer aren't the only circuit components whose provide a variable resistance. In fact there are many others: providing a different resistance its a common behavior in most sensors.

In the Arduino Base Workshop KIT I have two components of this type: a 4,7K Ohm Thermistor and a 10..40K Ohm LDR VT90N2. Let's have a look at them.

Potentiometers: what they are, how they work and how to use them with Arduino

Last updated on Wed, 2010-07-14 01:30. Originally submitted by fabio on 2010-06-10 12:02.

In this blog post I'll start experiencing with potentiometers and how to use them with Arduino.

Voltage divider circuits

There are situations in which one part of a circuit only needs a percentage of the available current. An example I already experienced is using an LED in series with a resistor. The resistor is used to limit the voltage which get to the LED which could otherwise get damaged. The same idea is used in voltage-dividing components, commonly called voltage dividers.

Voltage dividers find wide application in electric meter circuits, where specific combinations of series resistors are used to "divide" a voltage into precise proportions as part of a voltage measurement device. You can understand how voltage dividers works by having a look at the following picture:

Hey Arduino, say hello to the world!

Last updated on Mon, 2010-07-12 19:15. Originally submitted by fabio on 2010-06-09 12:54.

Ok, here we are. As any programmer knows, the first thing you have to do in order to learn a new programming language / environment is trying to print or display some simple text, usually the words Hello World.

Unfortunately, a stock Arduino doesn't have any screen so it's pretty common to connect an LED to the Arduino and just blink it. This is how microcontroller programmers are used to say hello world!

Headcam Timelapse Experiment - Bike Pride Torino 2010

Submitted by fabio on Mon, 2010-06-07 09:27.

Yesterday I've been to the first BikePride organized here in Torino, my city. It's been a pretty great and funny experience. Lot of people, relaxed environment, funny persons, sun and bikes everywhere! I really had a good time.

I always liked the time-lapse technique and always wanted to try it. So, a bike pride, with 2 hours of biking between lot of other bikes was the perfect occasion for such a test. Obviously, as I was riding, I couldn't use a tripod. I needed an headcam!