Modifications
Sauter à la navigation
Sauter à la recherche
← Modification précédente
Modification suivante →
ENG-CANSAT-NEOPIXEL
(voir la source)
Version du 30 octobre 2018 à 14:38
758 octets ajoutés
,
30 octobre 2018 à 14:38
→Installing the library
Ligne 38 :
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.
+
+
<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}}
Admin
Bureaucrates
,
Administrateurs
29 837
modifications
Menu de navigation
Outils personnels
Se connecter
Espaces de noms
Page
Discussion
Variantes
Affichages
Lire
Voir le texte source
Voir l’historique
Plus
Rechercher
Navigation
ARDUINO
RASPBERRY-PI
[:: PI Hacking ::]
Particle.IO
Micro Python
Imprimante 3D
Actualités
Modifications récentes
Page au hasard
Aide
Outils
Pages spéciales
Version imprimable