Skip to content

Instantly share code, notes, and snippets.

@bphermansson
Last active February 4, 2017 15:22
Show Gist options
  • Save bphermansson/cab65e08353045f581ab28cf95d10917 to your computer and use it in GitHub Desktop.
Save bphermansson/cab65e08353045f581ab28cf95d10917 to your computer and use it in GitHub Desktop.
Python script to set a Esp-12 in programming mode.
#!/usr/bin/env python
import RPi.GPIO as GPIO
from time import sleep
# Setup Gpio
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3, GPIO.OUT) # Pin 3 (Gpio 2). To Esp Gpio0.
GPIO.setup(5, GPIO.OUT) # Pin 5 (Gpio 3). To Esp reset ("RST").
# Set D0 low
GPIO.output(3, GPIO.LOW)
# Wait
sleep(1)
# Set reset low
GPIO.output(5, GPIO.LOW)
sleep(1)
# "Release" both buttons.
GPIO.output(5, GPIO.HIGH)
sleep(1)
GPIO.output(3, GPIO.HIGH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment