Skip to content

Commit c975a0e

Browse files
authored
Merge pull request #1 from Edrig/master
Add secret.h
2 parents b55e9a0 + 228da29 commit c975a0e

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

twitch_chat_ws2812b/secret.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#define SECRET_SSID "YOUR_SSID" // replace MySSID with your WiFi network name
2+
#define SECRET_PASS "YOUR_PASSWORD" // replace MyPassword with your WiFi password
3+
4+
5+
#define TWITCH_OAUTH_TOKEN "YOUR_OAUTH_TOKEN" // per Twitch's API
6+
// developer guide: https://twitchapps.com/tmi
7+
#define TWITCH_NICK "YOUR_CHANNELS_NAME" // e.g., acrobotik
8+
#define TWITCH_CHANNEL "#YOUR_CHANNELS_NAME" // e.g., #acrobotik

twitch_chat_ws2812b/twitch_chat_ws2812b.ino

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333
#include <ArduinoJson.h>
3434
#include <FastLED.h>
3535

36+
#include "secret.h"
37+
3638
// Initialize network parameters
37-
const char* ssid = "YOUR_SSID";
38-
const char* password = "YOUR_PASSWORD";
39+
const char ssid[] = SECRET_SSID;
40+
const char password[] = SECRET_PASS;
3941

4042
// Declare websocket client class variable
4143
WebSocketsClient webSocket;
@@ -44,14 +46,14 @@ WebSocketsClient webSocket;
4446
StaticJsonDocument<200> doc;
4547

4648
// Parameters for Twitch channel
47-
#define TWITCH_OAUTH_TOKEN "YOUR_OAUTH_TOKEN" // per Twitch's API
48-
// developer guide: https://twitchapps.com/tmi
49-
#define TWITCH_NICK "YOUR_CHANNELS_NAME" // e.g., acrobotik
50-
#define TWITCH_CHANNEL "#YOUR_CHANNELS_NAME" // e.g., #acrobotik
49+
const char twitch_oauth_token[] = TWITCH_OAUTH_TOKEN;
50+
51+
const char twitch_nick[] = TWITCH_NICK;
52+
const char twitch_channel[] = TWITCH_CHANNEL;
5153

5254
// Define necessary parameters for controlling the WS2812B LEDs
5355
#define N_PIXELS 16
54-
#define LED_PIN 19 // labeled "D6" on the board
56+
#define LED_PIN 0 // labeled "D6" on the board
5557
#define LED_TYPE WS2811
5658
#define BRIGHTNESS 24 // a little dim for recording purposes
5759
#define COLOR_ORDER GRB
@@ -90,9 +92,9 @@ void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
9092
// If the websocket connection is succesful, try to join the IRC server
9193
case WStype_CONNECTED:
9294
Serial.printf("[WSc] Connected to: %s\n", payload);
93-
webSocket.sendTXT("PASS " + String(TWITCH_OAUTH_TOKEN) + "\r\n");
94-
webSocket.sendTXT("NICK " + String(TWITCH_NICK) + "\r\n");
95-
webSocket.sendTXT("JOIN " + String(TWITCH_CHANNEL) + "\r\n");
95+
webSocket.sendTXT("PASS " + String(twitch_oauth_token) + "\r\n");
96+
webSocket.sendTXT("NICK " + String(twitch_nick) + "\r\n");
97+
webSocket.sendTXT("JOIN " + String(twitch_channel) + "\r\n");
9698
break;
9799
// If we get a response, print it to Serial
98100
case WStype_TEXT: {
@@ -147,4 +149,4 @@ void setRgb(uint8_t i, uint8_t r, uint8_t g, uint8_t b) {
147149

148150
void loop() {
149151
webSocket.loop();
150-
}
152+
}

0 commit comments

Comments
 (0)