NeoPixel Ring simple sketch (c) 2013 Shae Erisson uzb neoPixel Ring oddiy eskiz (c) 2013 Shae Erisson


Download 13.22 Kb.
Sana09.11.2020
Hajmi13.22 Kb.
#142801
Bog'liq
Simple code for PixelLED


// NeoPixel Ring simple sketch (c) 2013 Shae Erisson UZB NeoPixel Ring oddiy eskiz (c) 2013 Shae Erisson

// Released under the GPLv3 license to match the rest of the Qolganlariga mos kelish uchun GPLv3 litsenziyasi bo'yicha chiqarilgan

// Adafruit NeoPixel library Adafruit NeoPixel kutubxonasi

#include

#ifdef __AVR__

#include // Required for 16 MHz Adafruit Trinket 16 MGts Adafruit Trinket uchun talab qilinadi

#endif

// Which pin on the Arduino is connected to the NeoPixels? Arduino-dagi qaysi PIN NeoPixels-ga ulangan?



#define PIN 6 // On Trinket or Gemma, suggest changing this to 1 Trinket yoki Gemma-da buni 1 ga o'zgartirishni tavsiya eting

// How many NeoPixels are attached to the Arduino? Arduino-ga nechta NeoPiksel biriktirilgan?

#define NUMPIXELS 16 // Popular NeoPixel ring size Populyar NeoPixel uzuk o'lchami

// When setting up the NeoPixel library, we tell it how many pixels, NeoPixel kutubxonasini o'rnatishda biz unga qancha pikselni aytamiz

// and which pin to use to send signals. Note that for older NeoPixel va signallarni yuborish uchun qaysi pin yordamida. Eslatma Eski NeoPixel uchun

// strips you might need to change the third parameter -- see the uchinchi parametrni o'zgartirish kerak bo'lishi mumkin bo'lgan chiziqlar - ga qarang

// strandtest example for more information on possible values. mumkin bo'lgan qiymatlar haqida ko'proq ma'lumot olish uchun strandtest misol.

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels Piksel orasidagi pauza vaqt (millisekundlarda)

void setup() {

// These lines are specifically to support the Adafruit Trinket 5V 16 MHz. Ushbu chiziqlar Adafruit Trinket 5V 16 MGts qo'llab-quvvatlash uchun maxsus mo'ljallangan.

// Any other board, you can remove this part (but no harm leaving it): Boshqa biron bir taxtada, siz ushbu qismni olib tashlashingiz mumkin (lekin uni qoldiradigan zarari yo'q):

#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)

clock_prescale_set(clock_div_1);

#endif

// END of Trinket-specific code. Trinket-maxsus kodning tugashi.

pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) NeoPixel tasma ob'ekti (TALAB QILINADI)

}

void loop() {



pixels.clear(); // Set all pixel colors to 'off' Barcha piksel ranglarini "o‘chirish" ga sozlash

// The first NeoPixel in a strand is #0, second is 1, all the way up Dastlabki NeoPixel - bu # 0, ikkinchisi - 1, yuqoriga

// to the count of pixels minus one. minus bitta piksel soniga.

for(int i=0; i

// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255 piksel.Color () 0,0,0 dan 255,255,255 gacha bo'lgan RGB qiymatlarini oladi

// Here we're using a moderately bright green color: Bu erda biz engil och yashil rangdan foydalanamiz:

pixels.setPixelColor(i, pixels.Color(0, 150, 0));

pixels.show(); // Send the updated pixel colors to the hardware. Yangilangan piksel ranglarini apparatga yuboring.



delay(DELAYVAL); // Pause before next pass through loop Keyingi aylanishdan oldin pauza qiling

}

}
Download 13.22 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling