I have found transmitter module as in link belowYou are getting ahead of yourself. You need to find a transmitter module, then write the method of communicating with it. Have you found one?
I am of a different opinion from Ernie - I think interrupts should be used. At the very least, they allow your main code to scale while maintaining the functionality the interrupt handles. Since we don't know what the end goal looks like, I would go with interrupts, but that's me.
Either way, you'll need to pick your transmitter before you can write code for it.
http://www.ebay.com/itm/IC2262-2272...ing-Receiver-Transmitter-Module-/131198056389
One of my friend also suggested to use interrupts to make the code simple. Let me work hard to find the best.. Your suggestions are always welcome
Specification:
Remote control
1.Operating voltage: DC12V (27A/12V battery x1)
2.Operating Current: 10mA @ 12V
3.Radiated power: 10mw @ 12V
4..Transmission distance :50-100M (Open field, the receiver sensitivity of -100dbm)
5.Transmitting frequency: 315MHZ
6.Modulation mode: ASK (Amplitude Modulation)
7.Encoder types: fixed code
With decoding receiver board
1.operating voltage DC5V
2.receiver sensitivity is-98db. Leg 7 bits, respectively, VT, D3, D2, D1, D0, the +5 V and GND.
3.VT is a valid signal high output pin Upon receiving a valid signal, the pin output high, may also drive the relay.
4.Size: 6.6*22*41mm
Note:
There are four buttons on the remote control, and respectively correspond to the four data bits to the receiving board output pin D0, D1, D2, and D3 of. Press the buttons transmit signals, the corresponding data bit is output high.