LedThing.ino.ino 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "FastLED.h"
  2. #include <SPI.h>
  3. #include <WiFiNINA.h>
  4. #define NUM_LEDS 50
  5. #define DATA_PIN 9
  6. char ssid[] = "Pannkakshuset";
  7. char pass[] = "lavalampa";
  8. CRGB leds[NUM_LEDS];
  9. int status = WL_IDLE_STATUS;
  10. WiFiServer server(80);
  11. void setup() {
  12. // put your setup code here, to run once:
  13. //Serial.begin(9600);
  14. Serial.begin(9600);
  15. while (!Serial) {
  16. ; // wait for serial port to connect. Needed for native USB port only
  17. }
  18. //pinMode(DATA_PIN, OUTPUT);
  19. while (status != WL_CONNECTED) {
  20. Serial.print("Attempting to connect to SSID: ");
  21. Serial.println(ssid);
  22. // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
  23. status = WiFi.begin(ssid, pass);
  24. // wait 10 seconds for connection:
  25. delay(10000);
  26. }
  27. server.begin();
  28. delay(3000);
  29. FastLED.addLeds<TM1804, DATA_PIN, BRG>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  30. FastLED.setBrightness(255);
  31. FastLED.clear();
  32. FastLED.show();
  33. delay(1000);
  34. }
  35. void loop() {
  36. // put your main code here, to run repeatedly:
  37. //Serial.println("Hello");
  38. //delay(1000);
  39. // leds[3] = CRGB::Blue;
  40. // leds[0] = CRGB::Red;
  41. // leds[1] = CRGB::Green;
  42. // leds[49] = CRGB::White;
  43. FastLED.clear();
  44. FastLED.show();
  45. uint8_t delta = 10;
  46. for (uint8_t i = 0; i < 360; i++) {
  47. //leds[i] = CRGB(255-i*4, 255-i*4, 255-i*4);
  48. fill_rainbow(leds, NUM_LEDS, i, delta);
  49. FastLED.show();
  50. delay(10);
  51. }
  52. }