Archive for August 2010

Tips and tricks (4)

Previous T&T Once again, the tips deals with… interrupts 😉 I was in the process of developping a new version of my rotary encoder libray for which I wanted to be able to set pins and ports. I quickly faced the question of the ISR. Should I write three identical routines ? (blah!). Should I […]

RTC Module (Part 3)

Part 1, 2, 3, 4, 5, 6, 7 Now that we have the hardware and the routines and functions ready, let’s apply them to a simple application. This one will print “tic”, wait half a second, print “tac” followed by the second index. (Real nutty stuff :-[) void loop() { int pinState = ((PINB >> oneHertzPin) & 0x01); if (lastPinState != pinState) […]

RTC Module (Part 2)

Part 1, 2, 3, 4, 5, 6, 7 After the hardware description of the module, I will describe here the code required for driving it with Arduino. Firstly, we need to establish a SPI communication between Arduino (the master) and DS1306 (the slave). And here is the initialization routine for the SPI void spi_init(void) { // Initialize SPI port // Input pin […]

Tips and Tricks (3)

Previous T&T This one deals again with arguments passed to functions/commands. This time, I wanted to pass PORTx as an argument, and possibly use its value within the function/command in order to set data direction (DDRx). The solution is pretty easy… once you know it 😉 . The exemples below illustrate two ways of achieving […]

Tips and Tricks (2)

Previous T&T For those, like myself, who come from the VB world, pointers have been a scarecrow for long and refrained the good willing volunteer from getting into the world of C… This tip deals with functions returning a string. Say that you want to return a string from a function (returnZ) that will be […]

RTC Module (Part 1)

Part 1, 2, 3, 4, 5, 6, 7 Let’s introduce today a new hardware module for Arduino, based on the very popular Maxim-Dallas DS1306 RTC. The choice of this RTC amongst the long list of available chips is driven by multiple reasons. Firstly, it’s free. Well, almost free. You can get it for free as a sample from Maxim-Dallas. Second it is […]

Arduino Enclosure (Part 2)

Part 1, 2, 3, 4, 5, 6, 7 Here are some more information related to the type of box that I am using for protecting my Arduino boards and shields. This is the box, made of two identical, fully symetrical shells and their two sliding sides: It is roomy enough for one Arduino board that you can firmly bolt on to the […]

Arduino Enclosure (Part 1)

Part 1, 2, 3, 4, 5, 6, 7 Real life testing of Arduino based prototype often requires a minimal protection of the board and some pannels for holding buttons, connectors and displays. The box must be able to contain an Arduino board and a proto shield at the minimum, and leave some apertures for the power supply input and the USB connector. […]