NAzT
3/8/2016 - 8:36 AM

esp8266.tv.ino

esp8266.tv.ino


#define SYNC_PIN 16
#define SIGNAL 5
#define PIN13 13

void setup() {

  pinMode(SYNC_PIN, OUTPUT);
  pinMode(SIGNAL, OUTPUT);
  pinMode(PIN13, OUTPUT);
  digitalWrite(PIN13, LOW);
  //  Serial.begin(250000);
  wdt_disable();


}

void loop() {


  for (int i = 0; i < 262; i++) {
    digitalWrite(SYNC_PIN, HIGH);
    digitalWrite(SIGNAL, LOW);
    delayMicroseconds(1);

    digitalWrite(SYNC_PIN, LOW);
    delayMicroseconds(3);

    digitalWrite(SYNC_PIN, HIGH);
    delayMicroseconds(7);

    digitalWrite(SIGNAL, HIGH);
    delayMicroseconds(22);

    digitalWrite(SIGNAL, LOW);
    delayMicroseconds(23);

  }

  //V-SYNC
  digitalWrite(PIN13, HIGH);
  for (int i = 0; i < 4; i++) {
    digitalWrite(SIGNAL, LOW);
    digitalWrite(SYNC_PIN, LOW);
    delayMicroseconds(28);

    digitalWrite(SYNC_PIN, HIGH);
    delayMicroseconds(4);
  }

  for (int i = 0; i < 4; i++) {
    digitalWrite(SIGNAL, LOW);
    digitalWrite(SYNC_PIN, LOW);
    delayMicroseconds(60);

    digitalWrite(SYNC_PIN, HIGH);
    delayMicroseconds(4);
  }


  for (int i = 0; i < 4; i++) {
    digitalWrite(SIGNAL, LOW);
    digitalWrite(SYNC_PIN, LOW);
    delayMicroseconds(28);

    digitalWrite(SYNC_PIN, HIGH);
    delayMicroseconds(4);
  }


  digitalWrite(PIN13, LOW);
}