IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

programme capteur de mouvement


Sujet :

C#

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Mars 2013
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2013
    Messages : 3
    Points : 1
    Points
    1
    Par défaut programme capteur de mouvement
    bonjour a tous, Je voudrais crée un programme avec mon capteur de mouvement infrarouge. D'es qu'il détecte une présence, ma constante passe a l'etat 1 (de base il est a l'etat 0). Pour qu'il allume une led.

    Je suis sur une carte panda FEZ II. je vous met mon programme en c trouver sur le site du capteur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    int ledPin = 13;
    int switchPin = 2;
    int value = 0;
     
    void setup() {
      pinMode(ledPin, OUTPUT);
      pinMode(switchPin, INPUT);
    }
     
    void loop() {
      value = digitalRead(switchPin);
      if (HIGH == value) {
        digitalWrite(ledPin, HIGH);
      }
      else {
        digitalWrite(ledPin, LOW);
      }
    } 
     
     
    Et voici se que j'ai essayer de faire un c#:
    using Microsoft.SPOT.Hardware;
    using Microsoft.SPOT.IO;
    using GHIElectronics.NETMF;
    using GHIElectronics.NETMF.Hardware;
    using GHIElectronics.NETMF.FEZ;
    using GHIElectronics.NETMF.IO;
    using System;
    using System.Threading;
    using System.Text;
     
    namespace Catpeur
    {
        public class Programe
        {
            public static void Main()
            {
                OutputPort MyLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.An3,true);
                InputPort capteurmvt = new InputPort((Cpu.Pin)FEZ_Pin.Digital.An2,true);
                int value = 0;
            }
     
            void setup()
            {
                pinMode(MyLED, OUTPUT);
                pinMode(capteurmvt, INPUT);
            }
     
            void loop()
            {
                value = digitalRead(capteurmvt);
                if (true == value)
                {
                    MyLED.Write(true);
                }
                else
                {
                    MyLED.write(false);
                }
            }
           Debug.Print("value " + value.ToString());
        }
    }
    Je ne sais pas si cela est juste ou non, je suis en terminale sti2d voila.

    Merci de votre compréhension.

  2. #2
    Membre confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Juin 2005
    Messages
    700
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Tourisme - Loisirs

    Informations forums :
    Inscription : Juin 2005
    Messages : 700
    Points : 488
    Points
    488
    Par défaut
    je ne sais pas si tu trouvera une réponse ici, ta question est très spécifique.
    N'y a t'il pas plutot des forums dédié à ce matériel?

  3. #3
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Mars 2013
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2013
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Ba j'ai regarder vaguement... Mais je n'ai trouver que des forums en anglais, ce qui, n'est pas mon point fort.

  4. #4
    Membre émérite
    Avatar de azstar
    Homme Profil pro
    Architecte Technique BizTalk/.NET
    Inscrit en
    Juillet 2008
    Messages
    1 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Technique BizTalk/.NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 198
    Points : 2 424
    Points
    2 424
    Par défaut
    ici on peut vérifier le syntaxe du code et non pas son fonctionnement

  5. #5
    Membre émérite
    Avatar de azstar
    Homme Profil pro
    Architecte Technique BizTalk/.NET
    Inscrit en
    Juillet 2008
    Messages
    1 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Technique BizTalk/.NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 198
    Points : 2 424
    Points
    2 424
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
     
    using Microsoft.SPOT.Hardware;
    using Microsoft.SPOT.IO;
    using GHIElectronics.NETMF;
    using GHIElectronics.NETMF.Hardware;
    using GHIElectronics.NETMF.FEZ;
    using GHIElectronics.NETMF.IO;
    using System;
    using System.Threading;
    using System.Text;
     
    namespace Catpeur
    {
    	public class Programe
    	{
    	    InputPort capteurmvt;
    		OutputPort MyLED;
    		public static void Main()//ET LA FCT D'ENTREE .C'EST LA 1ERE FCT APPELLE DANS UN PROGRAME C#
    		{
    			MyLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.An3,true);
    			capteurmvt = new InputPort((Cpu.Pin)FEZ_Pin.Digital.An2,true);
    			int value = 0;
    		}
     
    		void setup()//JE NE VOIE PAS OU ELLE EST APPELLE CETTE FCT DANS TON CODE
    		{
    			pinMode(MyLED, OUTPUT);// IL FAUT DECLARER OUTPUT .JE NE VOIE PAS LA DECLARATION
    			pinMode(capteurmvt, INPUT);
    		}
     
    		void loop()//JE NE VOIE PAS OU ELLE EST APPELLE CETTE FCT DANS TON CODE
    		{
    			value = digitalRead(capteurmvt);//digitalRead EST ELLE DEFINIE SUR LES USING SINON ELLE FAUT LA DEFINIR 
    			if (true == value)
    			{
    				MyLED.Write(true);
    			}
    			else
    			{
    				MyLED.write(false);
    			}
    		 }
     
    		 //Debug.Print("value " + value.ToString());//IL DOIT ETRE DANS FCT SOIT LE MAIN SOIT UNE AUTRE FCT 
    	}
    }

  6. #6
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Mars 2013
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2013
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Déjà un grand merci pour ton aide mais ce que je ne comprend pas c'est tes "FCT" désoler je débute en c#.

  7. #7
    Membre émérite
    Avatar de azstar
    Homme Profil pro
    Architecte Technique BizTalk/.NET
    Inscrit en
    Juillet 2008
    Messages
    1 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Technique BizTalk/.NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 198
    Points : 2 424
    Points
    2 424
    Par défaut
    ah désolé fct =fonction ;désolé encore j'ai oublié que le mode sms est interdit

    désolé encore;

    et si tu veux plus d'explication, je suis encore la

Discussions similaires

  1. Un étudiant développe un programme de capture de mouvements
    Par Hinault Romaric dans le forum Actualités
    Réponses: 31
    Dernier message: 03/10/2013, 12h59
  2. Réponses: 0
    Dernier message: 24/06/2013, 00h24
  3. Intel lance un concours de développement autour de son nouveau capteur de mouvement
    Par Gordon Fowler dans le forum Développement 2D, 3D et Jeux
    Réponses: 0
    Dernier message: 10/06/2013, 19h26
  4. Programmer des mouvements d'un robot
    Par x-programer dans le forum Intelligence artificielle
    Réponses: 2
    Dernier message: 14/10/2011, 23h50
  5. programmer un mouvement brownien
    Par ennouri dans le forum C++
    Réponses: 5
    Dernier message: 05/12/2007, 08h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo