The library (btw: I wrote it
) is functional for all ordinary low cost devices with a SC5262 / SC5272, HX2262 / HX2272, PT2262 / PT2272, EV1527, RT1527, FP1527 or HS1527 (maybe more/other ones I only know these) chipset built in the remote handset and as you don't know much about your system there is absolutely no guarantee that it will work as is with your fan because:
- The frequency might be another. Common frequencies are 315, 433, 868MHz (usually for simple remotes. mostly depends on what is legal in your region) or 2,4GHz (usually more complex things like wifi, bluetooth, video, xbee)
- (I don't think so but) the modulation AM/FM might be different
- The encoding might be another (there is no official standard but there is a good chance to reverse engineer this)
- There might be any kind of security system to prevent your system to be used by others. The systems for opening car doors often use a "rolling code" (=>keeloq) for example. That is sending a different code each time you press the button, based on a algorithm known to the transmitter and known to the receiver. Obviously these algorithms are closed source so I'd say it's nearly impossible to control these devices (except soldering a optocoupler/relay/transistor to the buttons on the genuine remote control)
Regarding your code, can you tell me what the 24 is for?
It's the bit length. The code is send binary and must be 24bits long.
5393 = 1010100010001b and to make it 24bits it is zero filled to 000000000001010100010001b
And the "set pulse length" variable of 320us is the length of the data stream from each push of a button on the handheld, correct? Is that an industry standard or just what you've found works best?
Something of the kind. It's the time for sending 1/4 bit... I can tell more about it if you're really interested in all the details
I think I've once seen a certain valid range in a datasheet and in practical experience there are values between 250 and 500us. You may set it to the value measured from your original remote and it might be useful to experiment with different values for fine tuning but in fact it shouldn't make a difference cause as I believe the receiver doesn't detect absolute but relative timings.