Python RPi.GPIO.setwarnings() Examples
The following are 30
code examples of RPi.GPIO.setwarnings().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
RPi.GPIO
, or try the search function
.
Example #1
Source File: __init__.py From phat-beat with MIT License | 7 votes |
def setup(): global _is_setup if _is_setup: return True atexit.register(_exit) GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup([DAT, CLK], GPIO.OUT) GPIO.setup(BUTTONS, GPIO.IN, pull_up_down=GPIO.PUD_UP) for button in BUTTONS: GPIO.add_event_detect(button, GPIO.FALLING, callback=_handle_button, bouncetime=200) _is_setup = True
Example #2
Source File: sakshat.py From SAKS-tutorials with GNU General Public License v2.0 | 6 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #3
Source File: TipiWatchDogService.py From tipi with GNU General Public License v3.0 | 6 votes |
def __init__(self): self.__RESET = 26 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(self.__RESET, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Do not proceed unless the reset signal has turned off # attempt to prevent restart storm in systemd print("waiting for reset to complete.") while GPIO.input(self.__RESET) != 1: time.sleep(0.100) pass GPIO.add_event_detect( self.__RESET, GPIO.FALLING, callback=onReset, bouncetime=100 ) print("GPIO initialized.")
Example #4
Source File: drive.py From SDRC with GNU General Public License v3.0 | 6 votes |
def __init__(self): GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(self.MotorFront1, GPIO.OUT) GPIO.setup(self.MotorFront2, GPIO.OUT) GPIO.setup(self.MotorFront, GPIO.OUT) GPIO.output(self.MotorFront, 0) GPIO.setup(self.MotorBack1, GPIO.OUT) GPIO.setup(self.MotorBack2, GPIO.OUT) GPIO.setup(self.MotorBack, GPIO.OUT) GPIO.output(self.MotorBack, 0) self.BackPWM = GPIO.PWM(self.MotorBack,100) self.BackPWM.start(0) self.BackPWM.ChangeDutyCycle(0) self.direction = 0
Example #5
Source File: garage.py From GarageQTPi with MIT License | 6 votes |
def __init__(self, config): # Config self.relay_pin = config['relay'] self.state_pin = config['state'] self.id = config['id'] self.mode = int(config.get('state_mode') == 'normally_closed') self.invert_relay = bool(config.get('invert_relay')) # Setup self._state = None self.onStateChange = EventHook() # Set relay pin to output, state pin to input, and add a change listener to the state pin GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(self.relay_pin, GPIO.OUT) GPIO.setup(self.state_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.add_event_detect(self.state_pin, GPIO.BOTH, callback=self.__stateChanged, bouncetime=300) # Set default relay state to false (off) GPIO.output(self.relay_pin, self.invert_relay) # Release rpi resources
Example #6
Source File: buzzer.py From rainbow-hat with MIT License | 6 votes |
def setup(): """Setup piezo buzzer.""" global _is_setup, pwm if _is_setup: return GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(BUZZER, GPIO.OUT) # Set up the PWM and then set the pin to input # to prevent the signal from being output. # Since starting/stopping PWM causes a segfault, # this is the only way to manage the buzzer. pwm = GPIO.PWM(BUZZER, 1) GPIO.setup(BUZZER, GPIO.IN) pwm.start(50) _is_setup = True
Example #7
Source File: hx711.py From hx711py3 with Apache License 2.0 | 6 votes |
def __init__(self, dout=5, pd_sck=6, gain=128, bitsToRead=24): self.PD_SCK = pd_sck self.DOUT = dout GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(self.PD_SCK, GPIO.OUT) GPIO.setup(self.DOUT, GPIO.IN) # The value returned by the hx711 that corresponds to your # reference unit AFTER dividing by the SCALE. self.REFERENCE_UNIT = 1 self.GAIN = 0 self.OFFSET = 1 self.lastVal = 0 self.bitsToRead = bitsToRead self.twosComplementThreshold = 1 << (bitsToRead-1) self.twosComplementOffset = -(1 << (bitsToRead)) self.setGain(gain) self.read()
Example #8
Source File: server.py From Adeept_PiCar-B_oldversion with GNU General Public License v3.0 | 6 votes |
def scan(): #Ultrasonic Scanning global dis_dir dis_dir = [] turn.ultra_turn(hoz_mid) #Ultrasonic point forward turn.ultra_turn(look_left_max) #Ultrasonic point Left,prepare to scan dis_dir=['list'] #Make a mark so that the client would know it is a list time.sleep(0.5) #Wait for the Ultrasonic to be in position cat_2=look_left_max #Value of left-position GPIO.setwarnings(False) #Or it may print warnings while cat_2>look_right_max: #Scan,from left to right turn.ultra_turn(cat_2) cat_2 -= 3 #This value determine the speed of scanning,the greater the faster new_scan_data=round(ultra.checkdist(),2) #Get a distance of a certern direction dis_dir.append(str(new_scan_data)) #Put that distance value into a list,and save it as String-Type for future transmission turn.ultra_turn(hoz_mid) #Ultrasonic point forward return dis_dir
Example #9
Source File: mymodem.py From genmon with GNU General Public License v2.0 | 6 votes |
def InitHardware(self): # NOTE: This function assumes the underlying hardware is the LTE Cat 1 Pi Hat # http://wiki.seeedstudio.com/LTE_Cat_1_Pi_HAT/ try: self.power_pin = 29 self.reset_pin = 31 GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(self.power_pin, GPIO.OUT) # Setup module power pin GPIO.setup(self.reset_pin, GPIO.OUT) # Setup module reset pin GPIO.output(self.power_pin, False) GPIO.output(self.reset_pin, False) return self.PowerUp() except Exception as e1: self.LogErrorLine("Error in LTEPiHat:InitHardware: " + str(e1)) return False #------------------LTEPiHat::PowerDown-------------------------------------
Example #10
Source File: server.py From Adeept_PiCar-B_oldversion with GNU General Public License v3.0 | 6 votes |
def scan_rev(): #Ultrasonic Scanning global dis_dir dis_dir = [] turn.ultra_turn(hoz_mid) #Ultrasonic point forward turn.ultra_turn(look_right_max) #Ultrasonic point Left,prepare to scan dis_dir=['list'] #Make a mark so that the client would know it is a list time.sleep(0.5) #Wait for the Ultrasonic to be in position cat_2=look_right_max #Value of left-position GPIO.setwarnings(False) #Or it may print warnings while cat_2<look_left_max: #Scan,from left to right turn.ultra_turn(cat_2) cat_2 += 3 #This value determine the speed of scanning,the greater the faster new_scan_data=round(ultra.checkdist(),2) #Get a distance of a certern direction dis_dir.append(str(new_scan_data)) #Put that distance value into a list,and save it as String-Type for future transmission turn.ultra_turn(hoz_mid) #Ultrasonic point forward return dis_dir
Example #11
Source File: sakshat.py From SAKS-SDK with GNU General Public License v2.0 | 6 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #12
Source File: serverTest.py From Adeept_PiCar-B_oldversion with GNU General Public License v3.0 | 6 votes |
def scan(): #Ultrasonic Scanning global dis_dir dis_dir = [] turn.ultra_turn(hoz_mid) #Ultrasonic point forward turn.ultra_turn(look_left_max) #Ultrasonic point Left,prepare to scan dis_dir=['list'] #Make a mark so that the client would know it is a list time.sleep(0.5) #Wait for the Ultrasonic to be in position cat_2=look_left_max #Value of left-position GPIO.setwarnings(False) #Or it may print warnings while cat_2>look_right_max: #Scan,from left to right turn.ultra_turn(cat_2) cat_2 -= 3 #This value determine the speed of scanning,the greater the faster new_scan_data=round(ultra.checkdist(),2) #Get a distance of a certern direction dis_dir.append(str(new_scan_data)) #Put that distance value into a list,and save it as String-Type for future transmission turn.ultra_turn(hoz_mid) #Ultrasonic point forward return dis_dir
Example #13
Source File: remote_control.py From piradio with GNU General Public License v3.0 | 6 votes |
def run(self): global remote_led global udpport global udphost log.init('radio') progcall = str(sys.argv) log.message(progcall, log.DEBUG) log.message('Remote control running pid ' + str(os.getpid()), log.INFO) signal.signal(signal.SIGHUP,signalHandler) exec_cmd('sudo service lirc start') remote_led = config.getRemoteLed() if remote_led > 0: GPIO.setwarnings(False) # Disable warnings GPIO.setmode(GPIO.BCM) # Use BCM GPIO numbers GPIO.setup(remote_led, GPIO.OUT) # Output LED flash_led(remote_led) else: log.message("Remote control LED disabled", log.DEBUG) udpport = config.getRemoteUdpPort() udphost = config.getRemoteUdpHost() log.message("UDP connect host " + udphost + " port " + str(udpport), log.DEBUG) listener()
Example #14
Source File: _button.py From ai-makers-kit with MIT License | 6 votes |
def __init__(self, channel, polarity=GPIO.FALLING, pull_up_down=GPIO.PUD_UP, debounce_time=0.08): if polarity not in [GPIO.FALLING, GPIO.RISING]: raise ValueError( 'polarity must be one of: GPIO.FALLING or GPIO.RISING') self.channel = int(channel) self.polarity = polarity self.expected_value = polarity == GPIO.RISING self.debounce_time = debounce_time GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(channel, GPIO.IN, pull_up_down=pull_up_down) self.callback = None
Example #15
Source File: status_led_class.py From piradio with GNU General Public License v3.0 | 6 votes |
def __init__(self, red_led=23, green_led=27, blue_led=22 ): self.red_led = red_led self.green_led = green_led self.blue_led = blue_led # Set up status LEDS GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) if self.red_led > 0: GPIO.setup(self.red_led, GPIO.OUT) if self.blue_led > 0: GPIO.setup(self.blue_led, GPIO.OUT) if self.green_led > 0: GPIO.setup(self.green_led, GPIO.OUT) return # Set the status to normal, busy, error or clear
Example #16
Source File: _button.py From ai-makers-kit with MIT License | 6 votes |
def __init__(self, channel, polarity=GPIO.FALLING, pull_up_down=GPIO.PUD_UP, debounce_time=0.08): if polarity not in [GPIO.FALLING, GPIO.RISING]: raise ValueError( 'polarity must be one of: GPIO.FALLING or GPIO.RISING') self.channel = int(channel) self.polarity = polarity self.expected_value = polarity == GPIO.RISING self.debounce_time = debounce_time GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(channel, GPIO.IN, pull_up_down=pull_up_down) self.callback = None
Example #17
Source File: digital_io_panel.py From niryo_one_ros with GNU General Public License v3.0 | 6 votes |
def __init__(self): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) lock = Lock() self.publish_io_state_frequency = rospy.get_param("~publish_io_state_frequency") self.digitalIOs = [DigitalPin(lock, GPIO_1_A, GPIO_1_A_NAME), DigitalPin(lock, GPIO_1_B, GPIO_1_B_NAME), DigitalPin(lock, GPIO_1_C, GPIO_1_C_NAME), DigitalPin(lock, GPIO_2_A, GPIO_2_A_NAME), DigitalPin(lock, GPIO_2_B, GPIO_2_B_NAME), DigitalPin(lock, GPIO_2_C, GPIO_2_C_NAME), DigitalPin(lock, SW_1, SW_1_NAME, mode=GPIO.OUT), DigitalPin(lock, SW_2, SW_2_NAME, mode=GPIO.OUT)] self.digital_io_publisher = rospy.Publisher('niryo_one/rpi/digital_io_state', DigitalIOState, queue_size=1) rospy.Timer(rospy.Duration(1.0 / self.publish_io_state_frequency), self.publish_io_state) self.get_io_server = rospy.Service('niryo_one/rpi/get_digital_io', GetDigitalIO, self.callback_get_io) self.set_io_mode_server = rospy.Service('niryo_one/rpi/set_digital_io_mode', SetDigitalIO, self.callback_set_io_mode) self.set_io_state_server = rospy.Service('niryo_one/rpi/set_digital_io_state', SetDigitalIO, self.callback_set_io_state)
Example #18
Source File: co2_t110.py From BerePi with BSD 2-Clause "Simplified" License | 6 votes |
def init_process(): print " " print "MSG - [S100, T110 CO2 Sensor Driver on RASPI2, Please check log file : ", LOG_PATH print "MSG - now starting to read SERIAL PORT" print " " # HW setup, GPIO GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.OUT) GPIO.setup(23, GPIO.OUT) GPIO.setup(24, GPIO.OUT) GPIO.setup(25, GPIO.OUT) logger.info(' *start* GPIO all set, trying to open serial port, SW starting ') rledAllOn() ###################################################################### # START Here. Main ###################################################################### # set logger file
Example #19
Source File: sakshat.py From SAKS-tutorials with GNU General Public License v2.0 | 6 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #20
Source File: sakshat.py From SAKS-tutorials with GNU General Public License v2.0 | 6 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #21
Source File: sakshat.py From SAKS-tutorials with GNU General Public License v2.0 | 6 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #22
Source File: led_manager.py From niryo_one_ros with GNU General Public License v3.0 | 6 votes |
def __init__(self): # Set warning false, and don't cleanup LED GPIO after exit # So the LED will be red only after the Rpi is shutdown GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(LED_GPIO_R, GPIO.OUT) GPIO.setup(LED_GPIO_G, GPIO.OUT) GPIO.setup(LED_GPIO_B, GPIO.OUT) rospy.sleep(0.1) self.state = LedState.OK self.set_led_from_state(dxl_leds=True) self.set_led_state_server = rospy.Service('/niryo_one/rpi/set_led_state', SetInt, self.callback_set_led_state) # Subscribe to hotspot and hardware status. Those values will override standard states self.hotspot_state_subscriber = rospy.Subscriber('/niryo_one/wifi/hotspot', Bool, self.callback_hotspot_state) self.hardware_status_subscriber = rospy.Subscriber('/niryo_one/hardware_status', HardwareStatus, self.callback_hardware_status) rospy.loginfo('LED manager has been started.')
Example #23
Source File: sakshat.py From SAKS-tutorials with GNU General Public License v2.0 | 6 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #24
Source File: apa102.py From rainbow-hat with MIT License | 6 votes |
def show(): """Output the buffer.""" global _gpio_setup if not _gpio_setup: GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup([DAT, CLK, CS], GPIO.OUT) _gpio_setup = True GPIO.output(CS, 0) _sof() for pixel in pixels: r, g, b, brightness = pixel _write_byte(0b11100000 | brightness) _write_byte(b) _write_byte(g) _write_byte(r) _eof() GPIO.output(CS, 1)
Example #25
Source File: display_oled.py From facepunch with MIT License | 5 votes |
def oled_reset(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(reset_pin, GPIO.OUT, initial=GPIO.LOW) GPIO.output(reset_pin, GPIO.LOW) time.sleep(0.1) GPIO.output(reset_pin, GPIO.HIGH) time.sleep(0.1)
Example #26
Source File: spi_clk_on.py From hometop_HT3 with GNU General Public License v3.0 | 5 votes |
def setup_gpio(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) # setup Header Pin23 for output GPIO.setup (11, GPIO.OUT)
Example #27
Source File: __init__.py From automation-hat with MIT License | 5 votes |
def setup(): global automation_hat, automation_phat, sn3218, _ads1015, _is_setup, _t_update_lights if _is_setup: return True _is_setup = True GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) try: import smbus except ImportError: if version_info[0] < 3: raise ImportError("This library requires python-smbus\nInstall with: sudo apt install python-smbus") elif version_info[0] == 3: raise ImportError("This library requires python3-smbus\nInstall with: sudo apt install python3-smbus") _ads1015 = ads1015(smbus.SMBus(1)) if _ads1015.available() is False: raise RuntimeError("No ADC detected, check your connections") try: import sn3218 except ImportError: raise ImportError("This library requires sn3218\nInstall with: sudo pip install sn3218") except IOError: pass if sn3218 is not None: sn3218.enable() sn3218.enable_leds(0b111111111111111111) automation_hat = True automation_phat = False _t_update_lights = AsyncWorker(_update_lights) _t_update_lights.start() atexit.register(_exit)
Example #28
Source File: Transmitter.py From 52-Weeks-of-Pi with MIT License | 5 votes |
def initialize_gpio(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(PIN, GPIO.OUT)
Example #29
Source File: sakshat.py From SAKS-tutorials with GNU General Public License v2.0 | 5 votes |
def saks_gpio_init(self): #print 'saks_gpio_init' GPIO.setwarnings(False) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(PINS.BUZZER, GPIO.OUT) GPIO.output(PINS.BUZZER, GPIO.HIGH) for p in [PINS.IC_TM1637_DI, PINS.IC_TM1637_CLK, PINS.IC_74HC595_DS, PINS.IC_74HC595_SHCP, PINS.IC_74HC595_STCP]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.LOW) for p in [PINS.BUZZER, PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.OUT) GPIO.output(p, GPIO.HIGH) for p in [PINS.TACT_RIGHT, PINS.TACT_LEFT, PINS.DIP_SWITCH_1, PINS.DIP_SWITCH_2]: GPIO.setup(p, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Example #30
Source File: fans_manager.py From niryo_one_ros with GNU General Public License v3.0 | 5 votes |
def setup_fans(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(FAN_1_GPIO, GPIO.OUT) GPIO.setup(FAN_2_GPIO, GPIO.OUT) rospy.sleep(0.05) rospy.loginfo("------ RPI FANS SETUP OK ------")