/* Arduino TV-B-Gone * * A recreation of the TV-B-Gone kit on an Arduino Duemilanove. * By Daedalus12, mtbf0, westfw and Pedrocrespo * */ #include struct codeElement { uint32_t onTime; // duration of "On" time uint32_t offTime; // duration of "Off" time }; struct powercode { uint32_t freq; // frequency struct codeElement codes[100]; // on/off codes, supposed to be 100 as maximum }; int i = 0; // we use this for iterating long cfreq; // we'll store each frequency here when needed const struct powercode sonyCode PROGMEM = { 37470, {{245, 60}, {123, 60}, {61 , 60}, {123, 60}, {61 , 60}, {123, 60}, {61 , 60}, {61 , 60}, {123, 60}, {61 , 60}, {61 , 60}, {61 , 60}, {61 , 2759}, {245, 60}, {123, 60}, {61 , 60}, {123, 60}, {61 , 60}, {123, 60}, {61 , 60}, {61 , 60}, {123, 60}, {61 , 60}, {61 , 60}, {61 , 60}, {61 , 0}} }; const struct powercode panasonicCode PROGMEM = { 36130, {{358,179}, {44, 45}, {44, 135}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 135}, {44, 135}, {44, 135}, {44, 135}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 135}, {44, 135}, {44, 135}, {44, 135}, {44, 45}, {44, 135}, {44, 7720}, {358, 180}, {44, 45}, {44, 135}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 135}, {44, 135}, {44 ,135}, {44 ,135}, {44, 45}, {44, 45}, {44, 135}, {44, 45}, {44, 135}, {44, 135}, {44, 135}, {44, 135}, {44, 45}, {44, 135}, {44, 0}} }; const struct powercode sony2Code PROGMEM = { 37470, { {245, 60}, {123, 60}, {123, 60}, {123, 60}, {123, 60}, {61, 60}, {123, 60}, {61, 60}, {123, 60}, {61, 60}, {61, 60}, {61, 60}, {61, 2636}, {246, 60}, {123, 60}, {123, 60}, {123, 60}, {123, 60}, {61, 60}, {123, 60}, {61, 60}, {123, 60}, {61, 60}, {61, 60}, {61, 60}, {61, 0} } }; const struct powercode sony3Code PROGMEM = { 74940, { {250, 63}, {121, 63}, { 60, 63}, {121, 63}, { 60, 63}, {121, 63}, { 60, 63}, { 60, 63}, {121, 63}, { 60, 63}, { 60, 63}, { 60, 63}, { 60, 2819}, {250, 63}, {121, 63}, { 60, 63}, {121, 63}, { 60, 63}, {121, 63}, { 60, 63}, { 60, 63}, {121, 63}, { 60, 63}, { 60, 63}, { 60, 63}, { 60, 0} } }; PROGMEM const powercode *powerCodes[] = { &sonyCode, &panasonicCode, &sony2Code, &sony3Code }; // select the codes you like int num_codes = (sizeof(powerCodes)/sizeof(*powerCodes)); // count how many codes are in the list void setup() { DDRD = _BV(DDD6); // sets Pin 6 as output } void loop(){ for(i=0;i