# (void *) blog

Posted on by

I spent the last weekend at EMF. It was a blast. Apart from the talks and “official” activities being just plain awesome, the atmosphere was fantastic as well.

One of the cool things I get to physically bring home from EMF is a pair of TiLDAs (one of them gifted to me by Jeremy (who, by the way, is working on an awesome project and you should all be keeping an eye on him)).

The TiLDA is EMF camp’s badge, something very common among hackcamps in general. This particular one, has two RGB LEDs, a 2.4GHz radio transceiver, a 1600mAh LiPo battery and a IR LED.

This is particularly interesting because you can do fun stuff like turning off televisions with it:

(sorry for the bad quality and vertical video)

However, there are some major and unexpected limitations: the ATmega 32u4 on which the Arduino Leonardo is based on (and by extension, the TiLDA) doesn’t have a Timer 2, which is needed to drive the PWM on pin 3.

There was a whole group of people much smarter than I trying to figure out a way to use one of the 32u4’s timers on pin 3, without much success, so I went down the easy route:

Hacking the hardware.

I basically bridged pin 9 to pin 3. This allows me to use the IRremote library.

However, I had to do some modifications to make it work - you can find the patch file at the end of the post.

Here is the sketch my TiLDA is running on that particular video:

#include <IRremote.h>

#include "pins.h"

IRsend irsend;

void TVB() {
for(int i = 0; i < 3; i++) {
irsend.sendNEC(0x20DF10EF, 32);
delay(40);
}
delay(10);
}

void setup()
{
pinMode(PIN_BUTTON, INPUT_PULLUP);
attachInterrupt(INT_BUTTON, TVB, CHANGE);
}

void loop() {

}


Very simple, but it works. The sketch I used to figure out the “magic number” that turns on my monitor is the following:

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
}

void loop() {
if (irrecv.decode(&results)) {
Serial.print(results.value, HEX);
Serial.print(" ");
Serial.print(results.decode_type, DEC);
Serial.print(" ");
Serial.println(results.bits, DEC);
irrecv.resume(); // Receive the next value
}
}


Posted on by | Posted in C, Hardware, Programación

### 6 Responses to EMF2012, and TiLDAs

1. Gaston Price says:

Could you please provide a better example written in a more suitable language for this task. It is not very clear what the Serial does. I think VB6 would be a good language for this programming place.

• fortytwo_de says:

Hello:

The Serial library creates a USART communication between the Arduino (or TiLDA in this case) and the computer.

• Naxxfish says:

As soon as you can get VB6 running on an Arudino …..shudders

2. Lucasbuck says:

Could you host your modified IRremoteInt.h, as when patching i get an error with hunk 5 :
Hunk #5 FAILED at 452.
1 out of 5 hunks FAILED

Thanks!

• fortytwo_de says:

http://u.jdiez.me/IRremoteInt.h

I hope this works for you! Also, make sure you have the latest Git revision, otherwise it won’t work.