Nodemcu esp8266 kullanırken hata

Gökdeniz611

Hectopat
Katılım
18 Nisan 2020
Mesajlar
9
Nodemcu esp8266yı çalıştırıp rgb ledimi kullanacaktım lakin kod çalışmadı shiftdelete kanalının kulaklık stand yapım videosundan almıştım bu kodu ama bir türlü olmadı yardımcı olursanız sevinirim. Resimlerde ve en altta hata mevcut mavi ile çizilen yerde hatayı veriyor.


Kod:
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>

char auth[] = "token";
char ssid[] = "ssid";
char pass[] = "password";

int rainbow_loop = 0;
int zebra_loop = 0;
int theater_loop=0;
int timer_1=0;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(14,D1, NEO_GRB + NEO_KHZ800);

uint32_t Wheel(byte WheelPos) {
  if (WheelPos < 85) {
    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
    WheelPos -= 170;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

BLYNK_WRITE(V1)
{
  rainbow_loop=1;
  theater_loop=0;
  zebra_loop=0;
}

BLYNK_WRITE(V3)
{
  rainbow_loop=0;
  theater_loop=1;
  zebra_loop=0;
}


BLYNK_WRITE(V2)
{

rainbow_loop=0;
zebra_loop =1;
theater_loop=0;
 
Serial.println("Veri Geldi");
int R = param[0].asInt();
int G = param[1].asInt();
int B = param[2].asInt();
Serial.println(R);
Serial.println(G);
Serial.println(B);

for(int i=0;i<strip.numPixels();i++){
strip.setPixelColor(i, strip.Color(R,G,B));
strip.show();
 }
}

void setup()
{
  rainbow_loop=1;
 
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);

  pinMode(D2,OUTPUT);
  digitalWrite(D2,HIGH);

  strip.begin();
  strip.show();

}

void loop()
{
  Blynk.run();
  if(rainbow_loop ==1)
  rainbowCycle(10);
  //theaterChaseRainbow(50);
  if(theater_loop ==1)
  theaterChaseRainbow(10);
}

void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
     
    }
    strip.show();
    timer_1 = 0;
    timer_1 = millis();
    Blynk.run();
    timer_1 = millis() - timer_1;
    Serial.println(timer_1);
    if(rainbow_loop ==0)
    break;
    delay(wait);
  }
}

void theaterChaseRainbow(uint8_t wait) {
  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
         timer_1 = 0;
     timer_1 = millis();
     Blynk.run();
     timer_1 = millis() - timer_1;
     Serial.println(timer_1);
      if(theater_loop ==0)
      return;
      }
      strip.show();
      delay(wait);

      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
         timer_1 = 0;
     timer_1 = millis();
     Blynk.run();
     timer_1 = millis() - timer_1;
     Serial.println(timer_1);
      if(theater_loop ==0)
      return;
      }
    }
  }
}

HATA MESAJI ;
Arduino:1.8.20 Hourly Build 2021/12/20 07:33 (Windows 10), Kart:"Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

sketch_apr09a:17:48: error: 'D1' was not declared in this scope; did you mean 'y1'?

   17 | Adafruit_NeoPixel strip = Adafruit_NeoPixel(14,D1, NEO_GRB + NEO_KHZ800);

      |                                                ^~

      |                                                y1

C:\Users\gokde\Documents\Arduino\sketch_apr09a\sketch_apr09a.ino: In function 'void setup()':

sketch_apr09a:74:11: error: 'D2' was not declared in this scope; did you mean 'V2'?

   74 |   pinMode(D2,OUTPUT);

      |           ^~

      |           V2

exit status 1

'D1' was not declared in this scope; did you mean 'y1'?



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 

Dosya Ekleri

  • Ekran görüntüsü 2022-04-10 001828.png
    Ekran görüntüsü 2022-04-10 001828.png
    59,6 KB · Görüntüleme: 32
  • Ekran görüntüsü 2022-04-10 001850.png
    Ekran görüntüsü 2022-04-10 001850.png
    62,2 KB · Görüntüleme: 31

Geri
Yukarı