diff --git a/Twitch_On_Air_Sign/ESP8266_OnAirSign/ESP8266_OnAirSign.ino b/Twitch_On_Air_Sign/ESP8266_OnAirSign/ESP8266_OnAirSign.ino new file mode 100644 index 000000000..225031bbf --- /dev/null +++ b/Twitch_On_Air_Sign/ESP8266_OnAirSign/ESP8266_OnAirSign.ino @@ -0,0 +1,107 @@ +/* + * Simple HTTP get webclient test + */ + +#include +#include + +const char* ssid = "ssid"; +const char* password = "password"; + +#define HOST "api.twitch.tv" +#define PATH "/kraken/streams/adafruit" +#define REFRESH 30 // seconds between refresh +#define LED 13 +#define PIN 12 +Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800); + +// Fill the dots one after the other with a color +void colorWipe(uint32_t c, uint8_t wait) { + for(uint16_t i=0; i>> Client Timeout !"); + client.stop(); + colorWipe(strip.Color(0, 0, 0), 50); // Off + return; + } + } + + boolean isStreaming = false; + while (client.connected()) { + if (client.find("\"stream\":{\"_id\":")) { + isStreaming = true; + } + } + + Serial.print("Streaming status: "); Serial.println(isStreaming); + digitalWrite(LED, isStreaming); + if (isStreaming) { + colorWipe(strip.Color(255, 0, 0), 50); // Red + } else { + colorWipe(strip.Color(0, 0, 0), 50); // Off + } + Serial.println("disconnecting from server."); + client.stop(); + + delay(REFRESH*1000); +} + diff --git a/Twitch_On_Air_Sign/ReadMe.txt b/Twitch_On_Air_Sign/ReadMe.txt new file mode 100644 index 000000000..9729e5b3e --- /dev/null +++ b/Twitch_On_Air_Sign/ReadMe.txt @@ -0,0 +1 @@ +Check out the tutorial at https://learn.adafruit.com/automatic-twitch-on-air-sign/ \ No newline at end of file diff --git a/Twitch_On_Air_Sign/WINC1500_OnAirSign/WINC1500_OnAirSign.ino b/Twitch_On_Air_Sign/WINC1500_OnAirSign/WINC1500_OnAirSign.ino new file mode 100644 index 000000000..ba9948c8c --- /dev/null +++ b/Twitch_On_Air_Sign/WINC1500_OnAirSign/WINC1500_OnAirSign.ino @@ -0,0 +1,134 @@ +#include +#include +#include + +#define PIN 12 +Adafruit_NeoPixel strip = Adafruit_NeoPixel(30, PIN, NEO_GRBW + NEO_KHZ800); + + +// Define the WINC1500 board connections below. +// If you're following the Adafruit WINC1500 board +// guide you don't need to modify these: +#define WINC_CS 8 +#define WINC_IRQ 7 +#define WINC_RST 4 +#define WINC_EN 2 // or, tie EN to VCC and comment this out + +#define LED 13 + +// Setup the WINC1500 connection with the pins above and the default hardware SPI. +Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST); + +// Or just use hardware SPI (SCK/MOSI/MISO) and defaults, SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V +//Adafruit_WINC1500 WiFi; + +char ssid[] = "ssid"; // your network SSID (name) +char pass[] = "password"; // your network password (use for WPA, or use as key for WEP) +int keyIndex = 0; // your network key Index number (needed only for WEP) + +int status = WL_IDLE_STATUS; +#define HOST "api.twitch.tv" +#define PATH "/kraken/streams/adafruit" +#define REFRESH 20 // seconds between refresh + +Adafruit_WINC1500SSLClient client; + +// Fill the dots one after the other with a color +void colorWipe(uint32_t c, uint8_t wait) { + for(uint16_t i=0; i