Keeloq receiver

31 Aug 2011

I have just joined mbed and I'am a complete novice..I have a keeloq receiver with a 4 bit output each going low on activation giveing 16 possible combinations..I was hopeing to input this to my mbed giveing a value in a variable for manipulation ..is BusIn the way to go..any help would be very much appreciated

31 Aug 2011

Hi Ian,

Sounds like a good approach; BusIn is an easy way to read a bus on a flexible selection of pins as a single variable. I assume there is some way you know if something has been received.

As a simple example, you could do something like the following to do things whenever the state changes (untested):

#include "mbed.h"

BusIn bus(p5, p6, p7, p8);

int main() {
    int last = 0;
    while(1) {
        if(last != bus) {
            last = bus;
            switch(last) {
                case 3: dosomething(); break;
                case 6: dosomethingelse(); break;
                default: dodefault(); break; 
            };
        }
    }
}

I'm sure with some investigation on the /handbook/BusIn page you should be heading in the right direction.

Simon

01 Sep 2011

Thank you Simon for the reply (So it is true about this forum.. )

I'm looking at /handbook/Busin as it does give greater flexibility to change the code at a later date..

amazing cristal ball you have as I have wired it useing p5,p6,p7,p8 before the post...Ian