Skip to content

Instantly share code, notes, and snippets.

@atrakeur
Last active March 15, 2016 12:09
Show Gist options
  • Save atrakeur/41779610172603db7acb to your computer and use it in GitHub Desktop.
Save atrakeur/41779610172603db7acb to your computer and use it in GitHub Desktop.
#define RST_PIN 8 //Reset pin
#define CHPD_PIN 9 //CHPD pin
#define GPIO_PIN 10 //Flashmode pin
void setup() {
//Open serial
Serial.begin(115200);
Serial1.begin(115200);
//Set pin modes on arduino
pinMode(RST_PIN, OUTPUT);
pinMode(CHPD_PIN, OUTPUT);
pinMode(GPIO_PIN, OUTPUT);
//CHPD et RESET in running state (HIGH)
//GPIO0 in flash mode (LOW)
digitalWrite(CHPD_PIN, HIGH);
digitalWrite(RST_PIN, HIGH);
digitalWrite(GPIO_PIN, LOW);
//Wait for serial to come up (Leonardo?)
while(!Serial);
}
void loop() {
//Upload firmware from computer to ESP
if ( Serial.available() ) { Serial1.write( Serial.read() ); }
//Upload ESP responces to computer
if ( Serial1.available() ) { Serial.write( Serial1.read() ); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment