CARVIEW |
Select Language
HTTP/2 200
date: Mon, 13 Oct 2025 07:14:41 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=0291b93e62f439c1da8cbef4c55e85d1eddd07ef84c48d49888a0ef81197bad0a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22CTky0nuqnIMCemJTzGkCi38jgFREQjFe%22%3B%7D; HttpOnly; Path=/
cf-ray: 98dd0a9dbe11d86d-BLR
#!/usr/bin/python3import RPi.GPIO as GPIOimport timeimport osimport sys - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import RPi.GPIO as GPIO
- import time
- import os
- import sys
- # GPIO setup
- IR_PIN = 18 # GPIO18 (physical pin 12)
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(IR_PIN, GPIO.OUT)
- # Fan remote codes (from your list)
- FAN_CODES = {
- "POWER": "CF8976",
- "SPEED1": "CFD12E",
- "SPEED2": "CF09F6",
- "SPEED3": "CF51AE",
- "SPEED4": "CFC936",
- "SPEED5": "CF11EE",
- "BOOST": "CFF10E",
- "SLEEP": "CF718E",
- "SLEEP1H": "CFA15E",
- "SLEEP2H": "CF619E",
- "SLEEP3H": "CF49B6",
- "SLEEP6H": "CF31CE"
- }
- # NEC protocol parameters
- CARRIER_FREQ = 38000 # 38kHz
- DUTY_CYCLE = 0.33 # 33% duty cycle is typical for IR LEDs
- BIT_1_SPACE = 0.00169 # 1.69ms
- BIT_0_SPACE = 0.00056 # 0.56ms
- PULSE_TIME = 0.00056 # 0.56ms
- START_PULSE = 0.009 # 9ms
- START_SPACE = 0.0045 # 4.5ms
- END_PULSE = 0.00056 # 0.56ms
- # Initialize PWM for IR modulation
- pwm = GPIO.PWM(IR_PIN, CARRIER_FREQ)
- pwm.start(0) # Start with 0% duty cycle (LED off)
- def send_nec_bit(bit):
- """Send a single bit using NEC protocol"""
- pwm.ChangeDutyCycle(DUTY_CYCLE) # Turn on carrier
- time.sleep(PULSE_TIME) # Pulse duration same for 0 and 1
- pwm.ChangeDutyCycle(0) # Turn off carrier
- # Space duration depends on bit value
- if bit == '1':
- time.sleep(BIT_1_SPACE)
- else:
- time.sleep(BIT_0_SPACE)
- def send_nec_code(hex_code):
- """Send full NEC protocol with the given hex code"""
- try:
- # Convert hex to binary
- binary = bin(int(hex_code, 16))[2:].zfill(32)
- # Send NEC start bit
- pwm.ChangeDutyCycle(DUTY_CYCLE) # Turn on carrier
- time.sleep(START_PULSE) # Start pulse (9ms)
- pwm.ChangeDutyCycle(0) # Turn off carrier
- time.sleep(START_SPACE) # Start space (4.5ms)
- # Send all 32 bits
- for bit in binary:
- send_nec_bit(bit)
- # Send final pulse
- pwm.ChangeDutyCycle(DUTY_CYCLE)
- time.sleep(END_PULSE)
- pwm.ChangeDutyCycle(0)
- print(f"✅ Successfully sent code: {hex_code}")
- return True
- except Exception as e:
- print(f"❌ Error sending code: {e}")
- return False
- def display_menu():
- """Display the menu of available commands"""
- os.system('clear') # Clear terminal
- print("=" * 50)
- print(" FAN REMOTE CONTROL - IR TRANSMITTER")
- print("=" * 50)
- print("Available commands:")
- print()
- print(" 1. Power ON/OFF")
- print(" 2. Speed 1")
- print(" 3. Speed 2")
- print(" 4. Speed 3")
- print(" 5. Speed 4")
- print(" 6. Speed 5")
- print(" 7. Boost Mode")
- print(" 8. Sleep Mode")
- print(" 9. Sleep 1 Hour")
- print(" 10. Sleep 2 Hours")
- print(" 11. Sleep 3 Hours")
- print(" 12. Sleep 6 Hours")
- print(" 13. Exit")
- print()
- print("=" * 50)
- def main():
- try:
- while True:
- display_menu()
- choice = input("Enter your choice (1-13): ")
- if choice == '1':
- send_nec_code(FAN_CODES["POWER"])
- elif choice == '2':
- send_nec_code(FAN_CODES["SPEED1"])
- elif choice == '3':
- send_nec_code(FAN_CODES["SPEED2"])
- elif choice == '4':
- send_nec_code(FAN_CODES["SPEED3"])
- elif choice == '5':
- send_nec_code(FAN_CODES["SPEED4"])
- elif choice == '6':
- send_nec_code(FAN_CODES["SPEED5"])
- elif choice == '7':
- send_nec_code(FAN_CODES["BOOST"])
- elif choice == '8':
- send_nec_code(FAN_CODES["SLEEP"])
- elif choice == '9':
- send_nec_code(FAN_CODES["SLEEP1H"])
- elif choice == '10':
- send_nec_code(FAN_CODES["SLEEP2H"])
- elif choice == '11':
- send_nec_code(FAN_CODES["SLEEP3H"])
- elif choice == '12':
- send_nec_code(FAN_CODES["SLEEP6H"])
- elif choice == '13':
- print("Exiting program...")
- break
- else:
- print("Invalid choice. Please try again.")
- # Pause before showing menu again
- input("\nPress Enter to continue...")
- except KeyboardInterrupt:
- print("\nProgram terminated by user")
- finally:
- pwm.stop()
- GPIO.cleanup()
- print("GPIO cleaned up")
- if __name__ == "__main__":
- print("IR Transmitter for Fan Remote")
- print("Make sure IR LED is connected to GPIO18 (pin 12)")
- print("Connect IR LED with a 100-330Ω resistor")
- time.sleep(2)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
-
✅ Marketplace Glitch ✅ Working NEVER SEEN BE...
JavaScript | 8 sec ago | 0.25 KB
-
💡 Instant BTC Profit Method ✅ Working
JavaScript | 9 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ Y
JavaScript | 17 sec ago | 0.25 KB
-
📝 EASY MONEY GUIDE ✅ Working 6
JavaScript | 26 sec ago | 0.25 KB
-
💵 Make 3000$ in 20 minutes 💵
JavaScript | 29 sec ago | 0.24 KB
-
📌 Instant BTC Profit Method ✅ Working E
JavaScript | 35 sec ago | 0.25 KB
-
💎 ChangeNOW Exploit
JavaScript | 39 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐ W
JavaScript | 45 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand