PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

simple.ino 1.6KB

3 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // NeoPixel Ring simple sketch (c) 2013 Shae Erisson
  2. // released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
  3. #include <Adafruit_NeoPixel.h>
  4. #ifdef __AVR__
  5. #include <avr/power.h>
  6. #endif
  7. // Which pin on the Arduino is connected to the NeoPixels?
  8. // On a Trinket or Gemma we suggest changing this to 1
  9. #define PIN 6
  10. // How many NeoPixels are attached to the Arduino?
  11. #define NUMPIXELS 16
  12. // When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
  13. // Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
  14. // example for more information on possible values.
  15. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
  16. int delayval = 500; // delay for half a second
  17. void setup() {
  18. // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  19. #if defined (__AVR_ATtiny85__)
  20. if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  21. #endif
  22. // End of trinket special code
  23. pixels.begin(); // This initializes the NeoPixel library.
  24. }
  25. void loop() {
  26. // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  27. for(int i=0;i<NUMPIXELS;i++){
  28. // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
  29. pixels.setPixelColor(i, pixels.Color(0,150,0)); // Moderately bright green color.
  30. pixels.show(); // This sends the updated pixel color to the hardware.
  31. delay(delayval); // Delay for a period of time (in milliseconds).
  32. }
  33. }