Skip to content

WiFi and NeoPixelBus Update #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lit_arduino.ino
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPIO0 is incorrect. NeoEsp8266DmaWs2812xMethod uses GPIO3.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@

const char* ssid = "OMITTED";
const char* password = "OMITTED";
const char* hostname = "OMITTED";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be made optional? Maybe by just not calling wifi.hostname if the hostname an empty string (and make "" the default). I'd like to keep it possible to install the same image on multiple devices without duplicate hostname issues.

const unsigned int port = 9000;
WiFiUDP socket;
char packetBuffer[PACKET_SIZE];
uint64_t latestTimestamp = 0;
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> neopixels(NUM_LEDS);

//****Uncomment NeoEsp8266DmaWs2812xMethod to use ESP01/01-S GPIO3 / RX ****
//NeoPixelBus<NeoGrbFeature, NeoEsp8266DmaWs2812xMethod> neopixels(NUM_LEDS);
//****Uncomment NeoEsp8266Uart1Ws2812xMethod to use ESP01/01-S GPIO2****
NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart1Ws2812xMethod> neopixels(NUM_LEDS);

void setup() {
Serial.begin(115200);
Expand All @@ -39,12 +44,12 @@ void connectToWifi()
Serial.println(ssid);

WiFi.disconnect();
WiFi.hostname(hostname);
WiFi.begin(ssid, password);

while (WiFi.status() == WL_DISCONNECTED) {
delay(500);
Serial.print(".");
//Serial.printf("%d", WiFi.status());
}
Serial.println("");
Serial.println("IP address: ");
Expand All @@ -53,7 +58,6 @@ void connectToWifi()

uint64_t extractTimestamp(char* packetBuffer, int len) {
char* timeArr = packetBuffer + len - 8;
// Serial.printf("%d %d %d %d %d %d %d\n", timeArr[0], timeArr[1], timeArr[2], timeArr[3], timeArr[4], timeArr[5], timeArr[6],timeArr[7]);
return timeArr[0] + (timeArr[1]<<8) + (timeArr[2]<<16) + (timeArr[3]<<24) + (timeArr[4]<<32) + (timeArr[5]<<40) + (timeArr[6]<<48) + (timeArr[7]<<56);
}

Expand Down