archives:netmf43:8_netmfclassbrainpad

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
archives:netmf43:8_netmfclassbrainpad [2019/02/02 09:12] – modification externe 127.0.0.1archives:netmf43:8_netmfclassbrainpad [2021/08/11 09:19] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +[[:archives:netmf43:accueilnetmf|{{ :iconemaison.jpg?nolink&25|Sommaire .NETMF v4.3 }}]]
  
 +===== Les classes de la carte BrainPad v1 ===== 
 +[Mise à jour le 18/1/2019]
 +
 +{{  :netmf43:brainpadico.png?100&nolink|}}{{  :netmf43:netmf.png?100&nolink|}}
 +
 +**La carte BrainPad v1**
 +{{ :netmf43:brainpadduino.jpg?nolink&400 |}}
 +
 +**Sources :** documentation sur le site de GHI Electronics [[https://docs.ghielectronics.com/software/netmf/intro.html|[lien]]]
 +
 +----
 +
 +**Classes**
 +^  ^  Nom  ^  Description  ^
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Accelerometer** |Accès à l'accéléromètre [[http://www.nxp.com/files/sensors/doc/data_sheet/MMA8453Q.pdf|MMA8453Q]] de la carte. Lecture de l'accélération sur les axes X, Y et Z.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Button** |Accès aux 4 touches de la carte par scrutation ou par événements.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Buzzer** |Accès au buzzer (déclenchement, arrêt, génération d'une notes ou d'une fréquences, réglage du volume)|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Color** |Représente une couleur en rouge, vert et bleu.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**DcMotor** |Accès à la sortie dédiée à la commande d'un moteur à courant continu 5V 200mA.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Display** |Contrôle de l'afficheur couleur 1.8" (128 px par 160 px) à [[https://www.displayfuture.com/Display/datasheet/controller/ST7735.pdf|ST7735R]] (Bus SPI) [[https://learn.adafruit.com/1-8-tft-display/overview|Adafruit]]. Texte, tracé de forme géométrique etc. **Ressource documentaire** : [[arduino:4a_graphique|Les afficheurs graphiques]]|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Expansion** |Définition des entrées / sorties du connecteur d'extension. |
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Image** | Représente une image.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Legacy** |Permet d'accèder aux anciennes version de la carte.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**LightBulb** |Accès à la Led RVB haute luminosité.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**LightSensor** |Accès au capteur de luminosité (LDR).|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Peripherals** |Définitions des périphériques de la carte BrainPad.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**ServoMotor** |Accès à la sortie dédiée à la commande d'un servomoteur.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**TemperatureSensor** |Accès au capteur analogique de température [[http://www.microchip.com/wwwproducts/en/MCP9701|MCP9701]]. |
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**TrafficLight** |Accès aux 3 Leds de la carte BrainPad.|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Wait** |Offre des méthodes de temporisation (en secondes ou millisecondes).|
 +
 +**Champs**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:constant_16x.png?nolink|}}|Looping|booléen toujours vrai|
 +
 +//Exemple//
 +<code csharp exemple.cs>
 +while(BrainPad.Looping){
 + // Code
 +}
 +</code>
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **WriteDebugMessage**(//string// message) |Affiche un message dans la fenêtre de sortie de l'éditeur Visual Studio (Community). |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **WriteDebugMessage**(//int// message)  | |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **WriteDebugMessage**(//double// message)  | |
 +
 +//Exemple//
 +<code csharp exemple.cs>
 +WriteDebugMessage("Température=" + temp.ToString());
 +</code>
 +
 +----
 +
 +==== Accelerometer ==== 
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//double// **ReadX**() |Lit l'accélération sur l'axe X. (-1 à 1) |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//double// **ReadY**() |Lit l'accélération sur l'axe y. (-1 à 1) |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//double// **ReadZ**() |Lit l'accélération sur l'axe z. (-1 à 1) |
 +
 +//Exemple//
 +<code csharp exemple.cs>
 +using System.Threading;
 +
 +class Program
 +{
 +    public void BrainPadSetup()
 +    {
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        BrainPad.Display.DrawText(0, 0, "X : " + BrainPad.Accelerometer.ReadX().ToString("F3"), BrainPad.Color.White);
 +        BrainPad.Display.DrawText(0, 10, "Y : " + BrainPad.Accelerometer.ReadY().ToString("F3"), BrainPad.Color.White);
 +        BrainPad.Display.DrawText(0, 20, "Z : " + BrainPad.Accelerometer.ReadZ().ToString("F3"), BrainPad.Color.White);
 +        Thread.Sleep(100);
 +    }
 +}
 +}
 +</code>
 +
 +----
 +
 +==== Button ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//bool// **IsDownPressed**() |Renvoie la valeur //vrai// si le bouton **Down** a été pressé. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//bool// **IsLeftPressed**()  |Renvoie la valeur //vrai// si le bouton **Left** a été pressé. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//bool// **IsPressed**()  |Renvoie la valeur //vrai// si un des quatre boutons a été pressé. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//bool// **IsRightPressed**()  |Renvoie la valeur //vrai// si le bouton **Right** a été pressé. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//bool// **IsUpPressed**()  |Renvoie la valeur //vrai// si le bouton **Up** a été pressé. |
 +
 +//Exemple 1 : scrutation du clavier//
 +<code csharp clavier.cs>
 +class Program
 +{
 +    int increment;
 +
 +    public void BrainPadSetup()
 +    {
 +        increment = 0;
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        if (BrainPad.Button.IsUpPressed())
 +        {
 +            increment = 100;
 +        }
 +        if (BrainPad.Button.IsDownPressed())
 +        {
 +            increment = -100;
 +        }
 +       ....
 +    }
 +}
 +</code>
 +
 +**Evènements**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:event_16x.png?nolink|}}|**ButtonChanged** |Un événement est déclenché quand l'état d'un bouton change. |
 +|{{:netmf43:event_16x.png?nolink|}}|**ButtonPressed** |Un événement est déclenché quand l'état d'un bouton est appuyé. |
 +|{{:netmf43:event_16x.png?nolink|}}|**ButtonReleased** |Un événement est déclenché quand l'état d'un bouton est relâché. |
 +
 +
 +**Enumérations**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:enumerator_16x.png?nolink|}}|**DPad** |Prend les valeurs :  Up, Down, Left, Right |
 +|{{:netmf43:enumerator_16x.png?nolink|}}|**State** |Prend les valeurs : Pressed, NotPressed |
 +
 +//Exemple 2 : les boutons génèrent des interruptions//
 +<code csharp BPINT.cs>
 +class Program
 +{
 +    public void BrainPadSetup()
 +    {
 +        BrainPad.Button.ButtonChanged += Button_ButtonChanged;
 +    }
 +
 +    void Button_ButtonChanged(BrainPad.Button.DPad button, BrainPad.Button.State state)
 +    {
 +        if (button == BrainPad.Button.DPad.Down)
 +        {
 +            if (state == BrainPad.Button.State.Pressed)
 +            {
 +                BrainPad.TrafficLight.TurnGreenLightOn();
 +            }
 +            else
 +            {
 +                BrainPad.TrafficLight.TurnGreenLightOff();
 +            }
 +        }
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        // Declared but not used
 +    }
 +
 +}
 +</code>
 +
 +**Délégué**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:delegate_16x.png?nolink|}}|//void// **ButtonEventHandler**(//DPad// button, //State// state) | |
 +
 +----
 +
 +==== Buzzer ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **PlayFrequency**(//int// Frequency) |Joue une fréquence. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **PlayNote**(//Note// note) |Joue une note. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **SetVolume**(//Volume// volume) |Règle le volume. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Stop**() |Coupe le son. |
 +
 +**Enumérations**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:enumerator_16x.png?nolink|}}|**Note** |**A** = 880 Hz, **ASharp** = 932 Hz, **B** = 988 Hz, **C** = 1047 Hz, **CSharp** = 1109 Hz, **D** = 1175 Hz, **DSharp** = 1244 Hz, **E** = 1319 Hz, **F** = 1397 Hz, **FSharp** = 1480 Hz, **G** = 1568 Hz, **GSharp** = 1661 Hz |
 +|{{:netmf43:enumerator_16x.png?nolink|}}|**Volume** |**Loud** : volume par défaut, **Quiet** : plus faible |
 +
 +//Exemple 1//
 +<code csharp frequence1.cs>
 +class Program
 +{
 +    int frequency, increment;
 +
 +    public void BrainPadSetup()
 +    {
 +        frequency = 0; increment = 0;
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        if (BrainPad.Button.IsUpPressed())
 +        {
 +            increment = 100;
 +        }
 +        if (BrainPad.Button.IsDownPressed())
 +        {
 +            increment = -100;
 +        }
 +        if (increment != 0)
 +        {
 +            frequency = frequency + increment;
 +            increment = 0;
 +            BrainPad.Buzzer.PlayFrequency(frequency);
 +            BrainPad.WriteDebugMessage(frequency);
 +            BrainPad.Wait.Seconds(0.2);
 +            BrainPad.Buzzer.Stop();
 +        }
 +    }
 +}
 +</code>
 +
 +//Exemple 2//
 +<code csharp frequence2.cs>
 +using System.Threading;
 +
 +class Program
 +{
 +    const int NoteC = 261;
 +    const int NoteD = 294;
 +    const int NoteE = 330;
 +    const int NoteF = 349;
 +    const int NoteG = 391;
 +
 +    const int Whole = 1000;
 +    const int Half = Whole / 2;
 +    const int QuarterDot = Whole / 3;
 +    const int Quarter = Whole / 4;
 +    const int Eighth = Whole / 8;
 +
 +    int[] note = {
 +                    NoteE, NoteE, NoteF, NoteG, NoteG, NoteF, NoteE,
 +                    NoteD, NoteC, NoteC, NoteD, NoteE, NoteE, NoteD,
 +                    NoteE, NoteD, NoteC, NoteC, NoteD, NoteE, NoteD,
 +                    NoteC, NoteC
 +                  };
 +
 +    int[] duration = {
 +                    Quarter,  Quarter,  Quarter, Quarter, Quarter, Quarter,
 +                    Quarter,  Quarter,  Quarter, Quarter, Quarter, Quarter, QuarterDot,
 +                    Eighth, Half, Quarter,  Quarter,  Quarter, Quarter, Quarter, Quarter,
 +                    Quarter,  Quarter,  Quarter, Quarter, Quarter, Quarter, QuarterDot,
 +                    Eighth,Whole
 +                  };
 +
 +
 +    public void BrainPadSetup()
 +    {
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        for (int i = 0; i < note.Length; i++)
 +        {
 +            BrainPad.Buzzer.Stop();
 +            BrainPad.Buzzer.PlayFrequency(note[i]);
 +            Thread.Sleep(duration[i]);
 +        }
 +
 +        Thread.Sleep(100);
 +    }
 +}
 +</code>
 +
 +----
 +
 +==== Color ====
 +
 +**Constructeur**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}|**Color**() |Construit une nouvelle instance de la classe couleur. |
 +|{{:netmf43:method_16x.png?nolink|}}|**Color**(//byte// red, //byte// green, //byte// blue) |Construit une nouvelle instance de la classe couleur en précisant le niveau de rouge, de vert et de bleu. |
 +
 +**Propriétés**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:property_20x.png?nolink|}}|**As565** |Précise la couleur au format 565.  |
 +|{{:netmf43:property_20x.png?nolink|}}|**B**|Niveau de bleu sur un octet. |
 +|{{:netmf43:property_20x.png?nolink|}}|**G**|Niveau de vert sur un octet. |
 +|{{:netmf43:property_20x.png?nolink|}}|**R**|Niveau de rouge sur un octet. |
 +
 +**Champs**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:constant_16x.png?nolink|}}|**Black**|Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**Blue**|Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**Cyan**|Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**Green**|Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**Magenta**|Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**Red**|Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**White** |Couleur prédéfinie. (Color)|
 +|{{:netmf43:constant_16x.png?nolink|}}|**Yellow**|Couleur prédéfinie. (Color)|
 +
 +----
 +
 +==== DcMotor ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **SetSpeed**(//double// speed) |Règle la fréquence de rotation du moteur (0 à 1) |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Stop**() |Arrête le moteur. |
 +
 +----
 +
 +==== Display ====
 +**Ressource documentaire** : [[arduino:4a_graphique|Les afficheurs graphiques]]
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Clear**() |Efface l'écran. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawCircle**(//int// x, //int// y, //int// r, //Color// color) |Dessine un cercle de rayon **r** à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawExtraLargeLetter**(//int// x, //int// y, //char// letter, //Color// color) |Ecrit une lettre **letter** de très grande taille à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawExtraLargeNumber**(//int// x, //int// y, //double// nb, //Color// color) |Ecrit un nombre **nb** de très grande taille à la position (**x,y**) dans la couleur **color**. **//Surchargée//** : //long// nb |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawExtraLargeText**(//int// x, //int// y, //string// text, //Color// color) |Ecrit un texte **text** de très grande taille à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawFilledRectangle**(//int// x, //int// y, //int// width, //int// height, //Color// color) |Dessine un rectangle plein (**width** par **height**) à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawImage**(//byte[]// data) |Dessine une image décrite par un tableau d'octets **data**. **//Surchargée//** : //int// x, //int// y, //Image// image |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawLargeLetter**(//int// x, //int// y, //char// letter, //Color// color) |Ecrit une lettre de grande taille à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawLargeNumber**(//int// x, //int// y, //double// nb, //Color// color) |Ecrit un nombre de grande taille à la position (**x,y**) dans la couleur **color**. **//Surchargée//** : //long// nb |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawLargeText**(//int// x, //int// y, //string// text, //Color// color) |Ecrit un texte de grande taille à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawLetter**(//int// x, //int// y, //char// letter, //Color// color) |Ecrit une lettre à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawLine**(//int// x0, //int// y0, //int// x1, //int// y1, //Color// color) | Dessine une ligne entre les points de coordonnées (**x0,y0**) et (**x1,y1**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawNumber**(//int// x, //int// y, //double// nb, //Color// color) |Ecrit un nombre à la position (**x,y**) dans la couleur **color**. **//Surchargée//** : //long// nb|
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawRectangle**(//int// x, //int// y, //int// width, //int// height, //Color// color) |Dessine un rectangle (**width** par **height**) à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **DrawText**(//int// x, //int// y, //string// text, //Color// color) |Ecrit un texte à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **SetPixel**(//int// x, //int// y, //Color// color) |Dessine un point à la position (**x,y**) dans la couleur **color**. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnOff**() |Eteint le rétroéclairage. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnOn**() |Active le rétroéclairage. |
 +
 +----
 +
 +==== Expansion ====
 +
 +**Classes imbriquées**
 +^  ^  Nom  ^  Champs  ^
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|AnalogInput|{{:netmf43:constant_16x.png?nolink|}} **PA2**, **PA3**, **PA6**, **PA7**, **PC3** |
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|Gpio |{{:netmf43:constant_16x.png?nolink|}} **PA10**,**PA2**, **PA3**, **PA6**, **PA7**, **PA9**, **PB3**, **PB4**, **PB5**, **PC3**|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|PwmOutput |{{:netmf43:constant_16x.png?nolink|}} **PA10**,**PA2**, **PA3**, **PA9**|
 +
 +----
 +
 +==== Image ====
 +
 +**Propriétés**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:property_20x.png?nolink|}}|**Height** |Hauteur de l'image (int) |
 +|{{:netmf43:property_20x.png?nolink|}}|**Pixels** |Tableau de pixels (byte[]) |
 +|{{:netmf43:property_20x.png?nolink|}}|**Width** |argeur de l'image (int) |
 +
 +**Constructeur**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}|**Image**(//int// width, //int// height) |Construit une image **width** par **height**. |
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}|//void// **SetPixel**(//int// x, //int// y, //Color// color) |Fixe le pixel en (**x,y**) à la couleur **color**. |
 +
 +----
 +
 +==== Legacy.Expansion ====
 +
 +**Classes imbriquées**
 +^  ^  Nom  ^  Champs  ^
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**AnalogInput** |{{:netmf43:constant_16x.png?nolink|}} **E1**, **E10**, **E**, **E2**, **E3**, **E9**|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Gpio** |{{:netmf43:constant_16x.png?nolink|}} **E1**, **E10**, **E11**, **E12**, **E2**, **E3**, **E4**, **E5**, **E6**, **E9**|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**PwmOutput** |{{:netmf43:constant_16x.png?nolink|}} **E10**, **E11**, **E12**, **E9**|
 +
 +----
 +
 +==== LightBulb ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **SetColor**(//Color// color) |Fixe la couleur **color** de la led haute luminosité. **//Surchargée//** : //double// R, //double// G, //double// B |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnOff**() |Désactive la Led. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnOn**() |Active la Led. |
 +
 +----
 +
 +==== LightSensor ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//double// **ReadLightLevel**() |Lit la luminosité ambiante (0 à 1). |
 +
 +//Exemple//
 +<code csharp LightSensor.cs>
 +class Program
 +{
 +    double level;
 +
 +    public void BrainPadSetup()
 +    {
 +      level = 0;
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        level = BrainPad.LightSensor.ReadLightLevel();
 +        BrainPad.WriteDebugMessage(level);
 +        if (level<0.5)
 +        {
 +            BrainPad.LightBulb.TurnOn();
 +        }
 +        else
 +        {
 +           BrainPad.LightBulb.TurnOff();
 +        }
 +    }
 +}
 +</code>
 +
 +----
 +
 +==== Peripherals ====
 +
 +**Champs**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:constant_16x.png?nolink|}}|**Buzzer**|Sortie PWM pour la commande du buzzer.|
 +|{{:netmf43:constant_16x.png?nolink|}}|**BuzzerVolumeController**|Sortie PWM pour la commande du volume du buzzer.|
 +|{{:netmf43:constant_16x.png?nolink|}}|**DcMotor**|Sortie PWM pour la commande d'un moteur à CC (5V - 200mA max).|
 +|{{:netmf43:constant_16x.png?nolink|}}|**LightSensor**|Lecture du capteur de luminosité (Entrée analogique).|
 +|{{:netmf43:constant_16x.png?nolink|}}|**ServoMotor****Gras**|Sortie PWM pour la commande d'un servomoteur.|
 +|{{:netmf43:constant_16x.png?nolink|}}|**TemperatureSensor**|Lecture du capteur de température (entrée analogique).|
 +
 +**Classes imbriquées**
 +^  ^  Nom  ^  Champs  ^
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Button** |{{:netmf43:constant_16x.png?nolink|}} **Down**, **Left**, **Right**, **Up**|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**Display****Gras** |{{:netmf43:constant_16x.png?nolink|}} **BackLight**, **ChipSelect**, **Control**, **Reset**, **SpiModule**  |
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**LightBulb** |{{:netmf43:constant_16x.png?nolink|}} **Blue**, **Red**|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**TouchPad** |{{:netmf43:constant_16x.png?nolink|}} **Left**, **Middle**, **Right**|
 +|{{:netmf43:class_yellow_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|**TrafficLight** |{{:netmf43:constant_16x.png?nolink|}} **Green**, **Red**, **Yellow**|
 +
 +----
 +
 +==== ServoMotor ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **SetPosition**(//int// position) | Règle la position angulaire d'un servomoteur.|
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Start**() |Active le signal de commande du servomoteur.|
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Stop**() |Désactive le signal de commande du servomoteur. |
 +
 +----
 +
 +==== TemperatureSensor ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//double// **ReadTemperature**() |Lit la valeur de température. |
 +
 +//Exemple//
 +<code csharp TemperatureSensor.cs>
 +using System.Threading;
 +
 +class Program
 +{
 +    public void BrainPadSetup()
 +    {
 +    }
 +
 +    public void BrainPadLoop()
 +    {
 +        double tempC = BrainPad.TemperatureSensor.ReadTemperature();
 +        BrainPad.Display.DrawText(0, 10, "Temperature : " + tempC.ToString("F2"), BrainPad.Color.White);
 +        Thread.Sleep(200);
 +    }
 +}
 +</code>
 +
 +----
 +
 +==== TrafficLight ====
 +
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnColorOff**(//Color// color) |Désactive la led color. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnColorOn**(//Color// color) |Active la led color. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnGreenLightOff**() |Désactive la led verte. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnGreenLightOn**() |Active la led verte. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnOffAllLight**() |Désactive toutes les leds. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//voi//d **TurnRedLightOf**f() |Désactive la led rouge. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnRedLightOn**() |Active la led rouge. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnYellowLightOff**() |Désactive la led jaune. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **TurnYellowLightOn**() |Active la led jaune. |
 +
 +//Exemple//
 +<code csharp TrafficLight.cs>
 +while (true)
 +        {
 +            BrainPad.TrafficLight.TurnGreenLightOn();
 +            BrainPad.Wait.Seconds(0.4);
 +            BrainPad.TrafficLight.TurnGreenLightOff();
 +            BrainPad.Wait.Seconds(0.4);
 +        }
 +</code>
 +
 +----
 +
 +==== Wait ====
 +**Méthodes**
 +^ ^  Syntaxe  ^  Description  ^
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Milliseconds**(//double// milliseconds) |Déclenche une temporisation exprimée en millisecondes. |
 +|{{:netmf43:method_16x.png?nolink|}}{{:netmf43:s_16x.png?nolink|}}|//void// **Seconds**(//double// seconds) |Déclenche une temporisation exprimée en secondes. |
 +
 +//Exemple//
 +<code csharp TrafficLight.cs>
 +while (true)
 +        {
 +            BrainPad.TrafficLight.TurnGreenLightOn();
 +            BrainPad.Wait.Seconds(0.4);
 +            BrainPad.TrafficLight.TurnGreenLightOff();
 +            BrainPad.Wait.Seconds(0.4);
 +        }
 +</code>
 +
 +----
 +==== Pour aller plus loin ====
 +Le connecteur mikroBUS permet d'étendre les fonctionnalités de la carte BrainPad (GPIO, I2C, SPI, UART). \\ Voir la page [[netmf43:5c_netmfcodebrainpadv1|CH5c. Exemples codés en C# pour la carte BrainPad v1]].