| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #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);
- FastLED.clear();
- FastLED.show();
- delay(1000);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- //Serial.println("Hello");
- //delay(1000);
- // leds[3] = CRGB::Blue;
- // leds[0] = CRGB::Red;
- // leds[1] = CRGB::Green;
- // leds[49] = CRGB::White;
- FastLED.clear();
- FastLED.show();
- uint8_t delta = 10;
- for (uint8_t i = 0; i < 360; i++) {
- //leds[i] = CRGB(255-i*4, 255-i*4, 255-i*4);
- fill_rainbow(leds, NUM_LEDS, i, delta);
- FastLED.show();
- delay(10);
- }
- }
|