close-circle
Close
0%
0%

Flashing Light Prize (5) IoT Pacing

Stress Shd Be More Stressful

Similar projects worth following
close

Stress shd be more stressful.

Button(s) to NodeMCU ESP8266 to Al Gore to .php to .txt to Processing to Arduino to Relay to Alligator Clips to the Future...

Notation(s)

1. Originally intended on bluetooth communication between Processing and Arduino Uno with HC-06 module -- how and ever, Processing consistently stalled despite a perceived stable port of call and there is suspicion this was as result of an incompatible native bluetooth.

2. 'status' and 'state' are not like the other. Check your values! Sigh. Thx, Jason Harper.

3. TVShow is shot before no live studio audience...or crew. Often times focus is considered a victory -- here, there is one scene in defeat. We are not DC, we reshoot nothing!

4. A few necessary corrections to the dialog followed by an abundance of totally unnecessary changes in order to preserve the perception that there was no careless thievery. Even the impression could hardly be considered professional -- sigh.

Archive

https://hackaday.io/project/26022-flashing-light-prize-5-iot-pacing

http://flashinglightprize.com

https://sindrelindstad.com/projects/how-to-led-arduino-php-proc/

http://tvmiller.com/index.php?entry=entry170722-185830

https://vid.me/vUrEh

  • 1 × Arduino Uno
  • 1 × NodeMCU ESP-12E 1.0
  • 2 × Momentary Button
  • 1 × NPN Transistor
  • 1 × 1K Resistor (used spare 10K)

View all 7 components

  • NodeMCU Sktepch

    Vije Miller07/21/2017 at 02:41 0 comments

    // Flashing Light Prize (5) IoT Pacing
    // Step Code
    // VijeMiller
    // NodeMCU ESP-12E 1.0
    #include <ESP8266WiFi.h>
    #include <ESP8266HTTPClient.h>
    // WIFI Network Access
    const char* ssid = "networkID";
    const char* password = "networkpassword";
    WiFiServer server(80);
    // Buttons
    const int left = D2;
    const int right = D3;
    // Buttons State
    int lstate;
    int rstate;
    int state = 0;
    int led = D0;
    void setup() {
      pinMode(left, INPUT);
      pinMode(right, INPUT);
      pinMode(led, OUTPUT);
      Serial.begin(9600);
      while (WiFi.status() != WL_CONNECTED) {
        WiFi.begin(ssid, password);
        delay(5000);
      }
      Serial.println("Connected");
      digitalWrite(led, HIGH);
      server.begin();
    }
    void loop() {
      // Read Buttons
      lstate = digitalRead(left);
      rstate = digitalRead(right);
      // Declare Task
      HTTPClient http;
      int httpCode;
      if (lstate == HIGH && rstate == LOW) {
        // Prevent Excess
        if (state == 0) {
          Serial.println("L");
          // Load .php that writes to .txt
          http.begin("http://website.com/flp/flp.php?state=1");
          httpCode = http.GET();
          http.end();
          state = 1;
        } else {
          // Nothing
        }
      } else if (rstate == HIGH && lstate == LOW) {
        if (state == 1) {
          Serial.println("R");
          http.begin("http://website.com/flp/flp.php?state=0");
          httpCode = http.GET();
          http.end();
          state = 0;
        } else {
          // Nothing
        }
      } else if (lstate == HIGH && rstate == HIGH) {
        // Zilch
      } else if (lstate == LOW && rstate == LOW) {
        // Nope
      }
      delay(100);
    }

  • PHP-p-ing

    Vije Miller07/21/2017 at 02:39 0 comments

    <?php
    $onoroff = $_GET["state"];
    $textfile = "flp.txt";
    $fileLocation = "$textfile";
    $fh = fopen($fileLocation, 'w   ') or die("Crap!");
    $stringToWrite = "$onoroff";
    fwrite($fh, $stringToWrite);
    fclose($fh); 
    ?>

  • Processing Process

    Vije Miller07/21/2017 at 02:38 0 comments

    // Flashing Light Prize (5) IoT Pacing
    // Processing to Bluetooth
    // VijeMiller
    import processing.serial.*;
    Serial port;
    void setup() {
      println(Serial.list()); 
      port = new Serial(this, "COM3", 9600);
      frameRate(4);
    }
    void draw() {
      // Internet Address .txt File
      String onoroff[] = loadStrings("http://website.com/flp/flp.txt");
      // Prints .txt File Contents
      print(onoroff[0]);
      if (onoroff[0].equals("1") == true) {
        println("Flash");
        port.write('F');
      } else if (onoroff[0].equals("0") == true) {
        println("Unflash");
        port.write('U');
      } else {
      }
    }

  • Arduino Doodle

    Vije Miller07/20/2017 at 06:35 0 comments

    // Flashing Light Prize (5) Wireless Pacing
    // VijeMiller
    // Relay Pin
    int relay = 2;
    // Serial Data
    char data;
    void setup() {
      Serial.begin(9600);
      pinMode(relay, OUTPUT);
    }
    void loop() {
      // Communication?
      if (Serial.available() > 0) {
        // Whad' It Say?!
        data = Serial.read();
        // On?
        if (data == 'F') {
          digitalWrite(relay, HIGH);
        }
        // Off?
        if (data == 'U') {
          digitalWrite(relay, LOW);
        }
      }
    }

View all 4 project logs

  • 1
    Scheme-adict

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates