Modifications

Sauter à la navigation Sauter à la recherche
1 593 octets ajoutés ,  30 octobre 2018 à 14:50
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{ENG-CANSAT-NAV}}
 
{{ENG-CANSAT-NAV}}
   −
{{traduction}}
+
== What are NeoPixels? ==
 
  −
== What are NeoPixels ==
   
NeoPixel is a brand from Adafruit Industries. It concerns individually addressable LEDs that can be controlled with a single data line.
 
NeoPixel is a brand from Adafruit Industries. It concerns individually addressable LEDs that can be controlled with a single data line.
 +
Individually addressable means that you can control the color of each LED independently of the other.
   −
NeoPixel are usually sold in strand but also very popular is various form-factor.
+
NeoPixel are usually sold in strand but is also very popular is various form-factor.
    
[[Fichier:NeoPixel-UserGuide-21.jpg]]
 
[[Fichier:NeoPixel-UserGuide-21.jpg]]
Ligne 12 : Ligne 11 :  
The NeoPixels contains a small microcontroller used to decode the information send on the Data Line and using PWM generator to drive the LEDs.
 
The NeoPixels contains a small microcontroller used to decode the information send on the Data Line and using PWM generator to drive the LEDs.
   −
[[Fichier:NeoPixel-UserGuide-01.jpg]]
+
[[Fichier:NeoPixel-UserGuide-01.jpg|360px]]
    
It also include a constant current supply for the LED, which means that the color would not change with the supply voltage.
 
It also include a constant current supply for the LED, which means that the color would not change with the supply voltage.
Ligne 18 : Ligne 17 :  
NeoPixel is a very powerful technology. You can learn more about it from [https://learn.adafruit.com/adafruit-neopixel-uberguide the Adafruit's neoPixel User Guide] or the [[NeoPixel-UserGuide|translated NeoPixel user guide]].
 
NeoPixel is a very powerful technology. You can learn more about it from [https://learn.adafruit.com/adafruit-neopixel-uberguide the Adafruit's neoPixel User Guide] or the [[NeoPixel-UserGuide|translated NeoPixel user guide]].
   −
The Feather M0 Express also contains a NeoPixel LED.
+
=== Feather M0 NeoPixel ===
 +
The Feather M0 Express also contains a NeoPixel LED. This LED is used by the Microcontroller to inform the user about its running status (red or green).
 +
 
 +
[[Fichier:ENG-CANSAT-MISSION1-CAPTURE-10.png|360px]]
 +
 
 +
The great thing about this NeoPixel is that we can take the control of it from your Arduino sketch.
 +
 
 +
We just need to know the pin to use ('''pin 8''') and install the Adafruit NeoPixel Library for ATSAMD21 microcontroller :-)
 +
 
 +
The NeoPixel should be viewed as the very first LED of a NeoPixel Strand having only one single LED.
    
== Installing the library ==
 
== Installing the library ==
Ligne 30 : Ligne 38 :     
[[Fichier:ENG-CANSAT-NEOPIXEL-20.png|480px]]
 
[[Fichier:ENG-CANSAT-NEOPIXEL-20.png|480px]]
 +
 +
== Test script ==
 +
The following script demonstrate how to manipulate the onboard NeoPixel.
 +
 +
As there is only one pixel (one pixel on the strand), the function {{fname|pixel.setPixelColor()}} will always have the first parameter is set to 0!
 +
 +
This means that we change the color of the LED #0 on the ''pixel strand''.
 +
 +
<syntaxhighlight lang="c">
 +
#include <Adafruit_NeoPixel.h>
 +
 +
#define NEOPIXEL      8
 +
#define NUMPIXELS      1
 +
 +
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(NUMPIXELS, NEOPIXEL, NEO_GRB + NEO_KHZ800);
 +
 +
void setup() {
 +
  pixel.begin();
 +
  // switch OFF the pixel 0
 +
  pixel.setPixelColor(0, pixel.Color(0,0,0));
 +
  pixel.show();
 +
}
 +
 +
int red = 0;
 +
int green = 0;
 +
int blue = 0;
 +
 +
void loop(){
 +
  pixel.setPixelColor(0, pixel.Color(red,green,blue));
 +
  pixel.show();
 +
  red += 10;
 +
  if( red > 255 ){
 +
    red = 0;
 +
    green += 10;
 +
  }
 +
  if( green > 255 ){
 +
    green = 0;
 +
    blue += 10;
 +
  }
 +
  if( blue > 255 ){
 +
    blue = 0;
 +
  }
 +
  // Wait 100ms
 +
  delay( 100 );
 +
}
 +
</syntaxhighlight>
    
{{ENG-CANSAT-TRAILER}}
 
{{ENG-CANSAT-TRAILER}}
29 915

modifications

Menu de navigation