With this sensor it is possible for the 3D printer to detect when the filament has run out, so that it can pause and wait to switch to a new roll of filament, for example. Mechanically, it is a microswitch in a plastic housing (factory-made), with a channel to feed your filament. With this sensor you no longer have to worry about your filament running out.
Code for marlin:
//#define FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR) #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. #define FILAMENT_RUNOUT_SCRIPT "M600" #endif
For more information and to configure the runout sensor in marlin. See link.
Red: +5 v