diff options
author | Matthew Garrett <mjg59@google.com> | 2017-11-25T20·38-0800 |
---|---|---|
committer | Matthew Garrett <mjg59@google.com> | 2017-11-25T20·38-0800 |
commit | dd6eb8767e7a7f1f54aa1e7a7b57309bc4fc5fba (patch) | |
tree | 12f19fc58a3fef2ca1e4e619c6b6a21c3efa35d3 /README.md | |
parent | 8bc67af6d73c75587d40f6dbfa3b975c7d69a8a4 (diff) |
Experimental RF code
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/README.md b/README.md index 1305ea0f5a7b..48708827ce36 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,23 @@ Enter learning mode: devices[0].enter_learning() ``` +Sweep RF frequencies: +``` +devices[0].sweep_frequency() +``` + +Check whether a frequency has been found: +``` +found = devices[0].check_frequency() +``` +(This will return True if the RM has locked onto a frequency, False otherwise) + +Attempt to learn an RF packet: +``` +found = devices[0].find_rf_packet() +``` +(This will return True if a packet has been found, False otherwise) + Obtain an IR or RF packet while in learning mode: ``` ir_packet = devices[0].check_data() @@ -76,4 +93,24 @@ devices[0].set_power(1, True) Check power state on a SmartPowerStrip: ``` state = devices[0].check_power() -``` \ No newline at end of file +``` + +Learning RF packets +------------------- + +timeout = 10 +devices[0].sweep_frequency() +# Hold down the rf button +for i in range(0, timeout): + found = devices[0].check_frequency() + if found == True: + break + time.sleep(1) +# Tap the rf button +for i in range(0, timeout): + found = devices[0].find_rf_packet() + if found == True: + break + time.sleep(1) +# Obtain the code +code = devices[0].check_data() |