本文整理汇总了C++中Adafruit_NeoPixel::setPin方法的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_NeoPixel::setPin方法的具体用法?C++ Adafruit_NeoPixel::setPin怎么用?C++ Adafruit_NeoPixel::setPin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_NeoPixel
的用法示例。
在下文中一共展示了Adafruit_NeoPixel::setPin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_command
void process_command(byte argc, byte *argv){
// this takes a pixel command that has been determined and then
// processes it appropriately.
switch (argv[0]) {
case PIXEL_SHOW: {
show();
break;
}
case PIXEL_SET_STRIP: {
// sets the entirety of the strip to one colour
uint32_t strip_colour = (uint32_t)argv[1] + ((uint32_t)argv[2]<<7) + ((uint32_t)argv[3]<<14) + ((uint32_t)argv[4] << 21);
for (uint16_t i = 0; i<STRIP_LENGTH; i++) {
strip.setPixelColor(i, strip_colour);
}
break;
}
case PIXEL_SET_PIXEL: {
// sets the pixel given by the index to the given colour
uint16_t index = (uint16_t)argv[1] + ((uint16_t)argv[2]<<7);
uint32_t colour = (uint32_t)argv[3] + ((uint32_t)argv[4]<<7) + ((uint32_t)argv[5]<<14) + ((uint32_t)argv[6] << 21);
strip.setPixelColor(index, colour);
break;
}
case PIXEL_CONFIG: {
// Sets the pin that the neopixel strip is on.
strip.setPin((uint8_t)argv[1]);
// TODO: Sort out the strand length stuff here.
break;
}
}
}
示例2: begin
void InternetButton::begin(int i){
if(i == 1 || i == 0){
pin = 17;
b1 = 1;
b2 = 2;
b3 = 3;
b4 = 4;
}
ring.begin();
ring.setPin(pin);
ring.show();
accelerometer.begin(); // Setup SPI protocol, issue device soft reset
accelerometer.beginMeasure(); // Switch ADXL362 to measure mode
accelerometer.checkAllControlRegs(); // Burst Read all Control Registers, to check for proper setup
pinMode(b1, INPUT_PULLUP);
pinMode(b2, INPUT_PULLUP);
pinMode(b3, INPUT_PULLUP);
pinMode(b4, INPUT_PULLUP);
}