Add infrared remote control your printer. January 26, 2015 09:02AM |
Registered: 9 years ago Posts: 792 |
sudo apt-get install lirc
lirc_dev lirc_rpi gpio_in_pin=18
######################################################## # /etc/lirc/hardware.conf # # Arguments which will be used when launching lircd LIRCD_ARGS="--uinput" # Don't start lircmd even if there seems to be a good config file # START_LIRCMD=false # Don't start irexec, even if a good config file seems to exist. # START_IREXEC=false # Try to load appropriate kernel modules LOAD_MODULES=true # Run "lircd --driver=help" for a list of supported drivers. DRIVER="default" # usually /dev/lirc0 is the correct setting for systems using udev DEVICE="/dev/lirc0" MODULES="lirc_rpi" # Default configuration files for your hardware if any LIRCD_CONF="" LIRCMD_CONF="" ########################################################
sudo reboot
sudo /etc/init.d/lirc stop mode2 -d /dev/lirc0
space 16300 pulse 95 space 28794 pulse 80 space 19395 pulse 83 space 402351 pulse 135 space 7085 pulse 85 space 2903
sudo /etc/init.d/lirc stop
irrecord -d /dev/lirc0 ~/lircd.conf
# Please make this file available to others # by sending it to # # this config file was automatically generated # using lirc-0.9.0-pre1(default) on Sun Jan 18 14:59:06 2015 # # contributed by # # brand: /home/pi/lircd.conf.conf # model no. of remote control: # devices being controlled by this remote: # begin remote name /home/pi/lircd.conf.conf bits 16 flags SPACE_ENC|CONST_LENGTH eps 30 aeps 100 header 9006 4447 one 594 1648 zero 594 526 ptrail 587 repeat 9006 2210 pre_data_bits 16 pre_data 0xFF gap 107633 toggle_bit_mask 0x0 begin codes KEY_POWER 0xB24D KEY_GOTO 0x2AD5 KEY_MUTE 0x6897 KEY_RECORD 0x32CD KEY_UP 0xA05F KEY_TIME 0x30CF KEY_LEFT 0x50AF KEY_ENTER 0x02FD KEY_RIGHT 0x7887 KEY_0 0x48B7 KEY_DOWN 0x40BF KEY_BACK 0x38C7 KEY_1 0x906F KEY_2 0xB847 KEY_3 0xF807 KEY_4 0xB04F KEY_5 0x9867 KEY_6 0xD827 KEY_7 0x8877 KEY_8 0xA857 KEY_9 0xE817 end codes end remote
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf
sudo cp ~/lircd.conf /etc/lirc/lircd.conf
sudo /etc/init.d/lirc start
sudo nano /etc/lirc/lircrc
begin remote /etc/lircd/lircd.conf prog = irexec button = KEY_ENTER config = /var/www/post_api_printhead_xy-home.sh repeat = 1 end begin prog = irexec button = KEY_DOWN config = /var/www/post_api_printhead_down_10.sh repeat = 1 end begin prog = irexec button = KEY_LEFT config = /var/www/post_api_printhead_left_10.sh repeat = 1 end begin prog = irexec button = KEY_UP config = /var/www/post_api_printhead_up_10.sh repeat = 1 end begin prog = irexec button = KEY_RIGHT config = /var/www/post_api_printhead_right_10.sh repeat = 1 end begin remote /etc/lircd/lircd.conf prog = irexec button = KEY_POWER config = /var/www/post_api_printer_fans_on_M106.sh config = /var/www/post_api_printer_fans_off_M106-S0.sh repeat = 1 end begin prog = irexec button = KEY_1 config = /var/www/post_api_printer_extruder_temp_0.sh repeat = 1 end begin prog = irexec button = KEY_4 config = /var/www/post_api_printer_extruder_temp_190.sh repeat = 1 end begin prog = irexec button = KEY_7 config = /var/www/post_api_printer_extruder_temp_220.sh repeat = 1 end begin prog = irexec button = KEY_RECORD config = /var/www/post_api_printer_motors_off_M18.sh repeat = 1 end begin prog = irexec button = KEY_MUTE config = /var/www/post_api_printhead_z-home.sh repeat = 1 end begin prog = irexec button = KEY_GOTO config = /var/www/post_api_printhead_z-up_10.sh repeat = 1 end begin prog = irexec button = KEY_RECORD config = /var/www/post_api_printhead_z-down_10.sh repeat = 1 end begin prog = irexec button = KEY_2 config = /var/www/post_api_printer_bed_temp_0.sh repeat = 1 end begin prog = irexec button = KEY_5 config = /var/www/post_api_printer_bed_temp_50.sh repeat = 1 end begin prog = irexec button = KEY_8 config = /var/www/post_api_printer_bed_temp_100.sh repeat = 1 end begin prog = irexec button = KEY_9 config = /var/www/post_api_printhead_extrude_5.sh repeat = 1 end begin prog = irexec button = KEY_3 config = /var/www/post_api_printhead_retract_5.sh repeat = 1 end