Browse Source

Starts a server

jediemil 5 năm trước cách đây
mục cha
commit
8e1edf1777
1 tập tin đã thay đổi với 25 bổ sung0 xóa
  1. 25 0
      LedThing.ino/LedThing.ino.ino

+ 25 - 0
LedThing.ino → LedThing.ino/LedThing.ino.ino

@@ -1,12 +1,37 @@
 #include "FastLED.h"
+#include <SPI.h>
+#include <WiFiNINA.h>
+
 #define NUM_LEDS 50
 #define DATA_PIN 9
+char ssid[] = "Pannkakshuset";
+char pass[] = "lavalampa";
+
 CRGB leds[NUM_LEDS];
 
+int status = WL_IDLE_STATUS;
+
+WiFiServer server(80);
+
 void setup() {
   // put your setup code here, to run once:
   //Serial.begin(9600);
+  Serial.begin(9600);
+  while (!Serial) {
+    ; // wait for serial port to connect. Needed for native USB port only
+  }
   //pinMode(DATA_PIN, OUTPUT);
+  while (status != WL_CONNECTED) {
+    Serial.print("Attempting to connect to SSID: ");
+    Serial.println(ssid);
+    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
+    status = WiFi.begin(ssid, pass);
+
+    // wait 10 seconds for connection:
+    delay(10000);
+  }
+  server.begin();
+  
   delay(3000);
   FastLED.addLeds<TM1804, DATA_PIN, BRG>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
   FastLED.setBrightness(255);