当前位置: 首页>>代码示例>>C++>>正文


C++ Adafruit_NeoPixel::setBrightness方法代码示例

本文整理汇总了C++中Adafruit_NeoPixel::setBrightness方法的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_NeoPixel::setBrightness方法的具体用法?C++ Adafruit_NeoPixel::setBrightness怎么用?C++ Adafruit_NeoPixel::setBrightness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Adafruit_NeoPixel的用法示例。


在下文中一共展示了Adafruit_NeoPixel::setBrightness方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: glow

void glow(int del, int bri){
  int cb = 0;
  int d = del/(100 * bri/100);
  if(d < 1){
    d=1;
  }
  
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, R,G,B);
  }
  
  while(cb<bri){
    cb++;
    pixels.setBrightness(cb);
    pixels.show();
    delay(d);
  }
  
  while(cb>1){
    cb--;
    pixels.setBrightness(cb);
    pixels.show();
    delay(d);
  }
}
开发者ID:0x27,项目名称:redalert,代码行数:25,代码来源:lights.cpp

示例2: still

void still(int brightness){
  pixels.setBrightness(brightness);
    for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, R,G,B);
  }
  pixels.show();
}
开发者ID:0x27,项目名称:redalert,代码行数:7,代码来源:lights.cpp

示例3: disco

void disco(int del, int brightness){
  pixels.setBrightness(brightness);
  
  for(int i=0;i<NUMPIXELS;i++){
    int ran = random(0,2);
    if(ran == 0){
        int r = random(0,256);
        int g = random(0,256);
        int b = random(0,256);
        pixels.setPixelColor(i,r,g,b);
    }
  }
  pixels.show();
  delay(del * random(1,4));
  for(int i=0;i<NUMPIXELS;i++){
    int ran = random(0,4);
    if(ran !=0){
        int r = random(0,256);
        int g = random(0,256);
        int b = random(0,256);
        pixels.setPixelColor(i,0,0,0);
    }
  }
  pixels.show();
  delay(del * random(1,3));
}
开发者ID:0x27,项目名称:redalert,代码行数:26,代码来源:lights.cpp

示例4: police

void police(int del, int bri){
  pixels.setBrightness(bri);
  int delFac = 6;
  
  for(int k=0; k<6; k++){
    if(k==3){
      delay(del*delFac);
    }
    if(k<3){
      for(int i=0;i<NUMPIXELS/2;i++){
        pixels.setPixelColor(i, 255,0,0);
      }
    }
    else{
      for(int i=NUMPIXELS/2;i<NUMPIXELS;i++){
        pixels.setPixelColor(i, 0,0,255);
      }
    }
  
    pixels.show();
    delay(del);
    
    for(int i=0;i<NUMPIXELS;i++){
      pixels.setPixelColor(i, 0,0,0);

    }
    
    pixels.show();
    delay(del/2);
  }
  
  delay(del * delFac);
}
开发者ID:0x27,项目名称:redalert,代码行数:33,代码来源:lights.cpp

示例5: setup

void setup() {
    pinMode(PIN_DIAGNOSTIC_LED, OUTPUT);

    Serial.begin(9600);

    debug(F("initializing LED Strip\n"));
    strip.begin();
    strip.setBrightness(0xff);

    strip.show();

    Color sunset(0x80, 0x20, 0x20),
            morning(0xa0, 0x5e, 0x50),
            noon(0xff, 0xff, 0xff),
            afternoon(0xa0, 0x5e, 0x50),
            night(0x10, 0x15, 0x20);

    // switch on at 6 (use an external timer for that)
    fade(Color::OFF, sunset, minutes_to_ms(45));

    fade(sunset, morning, minutes_to_ms(30));

    fade(morning, noon, minutes_to_ms(45 + 4 * 60));

    fade(noon, noon, minutes_to_ms(4 * 60));

    fade(noon, afternoon, minutes_to_ms(2 * 60));

    fade(afternoon, sunset, minutes_to_ms(45));

    fade(sunset, night, minutes_to_ms( 30));

    fade(night, Color::OFF, minutes_to_ms(30));

}
开发者ID:neuhalje,项目名称:arduino-aquarium-lights,代码行数:35,代码来源:main.cpp

示例6: setup

void setup()
{
  Serial.begin(115200);
  strip.begin();
  strip.setBrightness(40);
  strip.show();
  cmdMessenger.attach(kSetLED, OnSetLed);
}
开发者ID:baillel,项目名称:rotonde-arduino-neopixel,代码行数:8,代码来源:main.cpp

示例7: setup

 void setup () {
   strip_h.begin();
   strip_d.begin();
   strip_s.begin();
   strip_h.show();
   strip_d.show();
   strip_s.show();
   Serial.begin(57600);
   Wire.begin();
   RTC.begin();
   strip_h.setBrightness(100);
   strip_d.setBrightness(100);
   strip_s.setBrightness(100);
 
   // if (! RTC.isrunning()) {
   // Serial.println("RTC is NOT running!");
   // following line sets the RTC to the date & time this sketch was compiled
   //   RTC.adjust(DateTime(__DATE__, __TIME__));
 }
开发者ID:wwebb,项目名称:WordClock,代码行数:19,代码来源:wordclock+(buckeyeworldcitizen).c

示例8: colorBeat

void colorBeat(uint32_t c, uint8_t wait){
  for(int j=0;j<2;j++){
    for(uint16_t i=0; i<pixels.numPixels();i++){
      pixels.setPixelColor(i,c);
    }
    pixels.show();
    fade();
    delay(wait);
    pixels.setBrightness(200);
  }

}
开发者ID:weareleka,项目名称:arduino-prototype-projects,代码行数:12,代码来源:remote-simplecode.cpp

示例9: runningLights

void runningLights(int del, int brightness){
    pixels.setBrightness(brightness);
    for(int i=0;i<NUMPIXELS;i++){
      pixels.setPixelColor(i, R, G, B);
      if(i!=0){
        pixels.setPixelColor(i-1, 0,0,0);
      }
      pixels.show();
      delay(del);
      pixels.setPixelColor(NUMPIXELS-1, 0,0,0);
    }
}
开发者ID:0x27,项目名称:redalert,代码行数:12,代码来源:lights.cpp

示例10: flashingLights

void flashingLights(int del, int brightness){
  pixels.setBrightness(brightness);
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, R,G,B);
  }
  
  pixels.show();
  delay(del);
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, 0,0,0);
  }
  
  pixels.show();
  delay(del);
}
开发者ID:0x27,项目名称:redalert,代码行数:15,代码来源:lights.cpp

示例11: setup

void setup()
{
// Arduino_h is only defined when compiling the sketch in the Arduino IDE.
#ifndef Arduino_h
    // Select line, circle or grid pixel layout for emulator.
    // pixels.setPixelLayout(Strip);
    pixels.setPixelLayout(Ring);
    // pixels.setPixelLayout(Grid);
#endif
    pixels.begin();
    // setBrightness() is intended for use only in setup() and not for animations. It's ignored by the emulator (see
    // the README).
    pixels.setBrightness(50);
    pixels.show();
}
开发者ID:thostr,项目名称:neopixelstuff,代码行数:15,代码来源:rgb_sketch.cpp

示例12: loop

void loop() {
  // put your main code here, to run repeatedly:
  reading = analogRead(potPin);
  val = (reading/1024.0) * 13;
  colorVal = (reading/1024.0) * 255;
  
  if (digitalRead(switchPin) == HIGH && lastButton == LOW)
  {
    delay(250); // Account for contact debounce
    NeopixelColor = !NeopixelColor;
    
  }
  
  if (NeopixelColor == false)
  {
    // Neopixel LED number code
    strip.setBrightness(40);
    if (val != prevVal)
    {
      for ( x = 0; x < val; x++) 
      {
        strip.setPixelColor(x,255,0,255);
      }
      for (x=val; x<13; x++) 
      { 
        strip.setPixelColor(x,0,0,0);
        strip.show();
      }
      prevVal = val;
    }
    else
    {
      strip.show();
    }
    
  }
  else
  {
    // Neopixel Color code
    for (x=0; x < prevVal; x++)
    {
      strip.setPixelColor(x,colorVal,0,255-colorVal);
      strip.show();
    }
  }
}
开发者ID:ismailuddin,项目名称:arduino,代码行数:46,代码来源:neopixel.c

示例13: setup_neopixel

void setup_neopixel() {
  SET_OUTPUT(NEOPIXEL_PIN);
  pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
  pixels.begin();
  pixels.show(); // initialize to all off

  #if ENABLED(NEOPIXEL_STARTUP_TEST)
    safe_delay(1000);
    set_neopixel_color(pixels.Color(255, 0, 0, 0));  // red
    safe_delay(1000);
    set_neopixel_color(pixels.Color(0, 255, 0, 0));  // green
    safe_delay(1000);
    set_neopixel_color(pixels.Color(0, 0, 255, 0));  // blue
    safe_delay(1000);
  #endif
  set_neopixel_color(pixels.Color(NEO_WHITE));       // white
}
开发者ID:3devangelist,项目名称:PrusaMendel,代码行数:17,代码来源:neopixel.cpp

示例14: setup

void setup() {
  Serial.begin(115200);
  pixels.begin();
  pixels.setBrightness(BASE_BRIGHTNESS);

  reset_pixels();

  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  WiFi.hostname(HOSTNAME);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("WiFi connected");
  Serial.println(WiFi.localIP());

  if (!MDNS.begin(HOSTNAME)) {
    update_pixel(0, 200, 0, 0);
    Serial.println("Error setting up MDNS responder!");
    while (1) {
      delay(1000);
    }
  }
  Serial.println("mDNS responder started");

  update_pixel(0, 0, 200, 0);
  pixels.show();

  server.begin();
  MDNS.addService("http", "tcp", 80);
}
开发者ID:prashnts,项目名称:dotfiles,代码行数:38,代码来源:esp8266_fw.c

示例15: tick

void ColorWipeEffect::tick(void) {
	// callcounter++;
	// if (callcounter % (*globalSpeedFactor) != 0)
	//  	return;
	 
	Section *sect = &sections[sectionsStart];
	Adafruit_NeoPixel *strip = sect->strip;

	// Fill the dots one after the other with a color
	int tempIndex = currentIndex;
	
	uint32_t tempColorValue = (uint32_t)*SabaleUtils::globalSourceColor;

    strip->setBrightness(tempIndex);
    strip->setPixelColor(tempIndex, tempColorValue);
    strip->show();

	currentIndex++;

	// Touched the end of the strip - go back to the start
	if (tempIndex == strip->numPixels()) {
		currentIndex = 0;
	}
}
开发者ID:rootux,项目名称:sabaled,代码行数:24,代码来源:ColorWipeEffect.cpp


注:本文中的Adafruit_NeoPixel::setBrightness方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。