Page 1 sur 1

Transcription de ? en python

Posté : mer. 15 avr. 2015 19:30
par Thesey62
Bonjour
Je dois connecter des capteurs et émetteurs infrarouge sur la raspberry et ecrire un programme python
Or je n'ai trouvé que cela
//IR sent demo v1.0
//Connect the IR sent pins to D3 for this demo
//By:http://www.seeedstudio.com/
//******************************
#include <IRSendRev.h>

void setup()
{
//enableIROut(38);
}
//unsigned char d[] = {9, 90, 91, 11, 31, 4, 1, 2, 3, 4};
unsigned char d[] = {15, 70, 70, 20, 60, 10, 1, 2, 3, 4,5,6,7,8,9,10};
//Very Important:
//the first parameter(15): the data that needs to be sent;
//the next 2 parameter(70,70): the logic high and low duration of "Start";
//the next 2 parameter(20,60): the logic "short" and "long"duration in the communication
// that to say: if "0", the high duration is 20ms and low is 20 ms; while logic "1",
// the high duration is 20 ms and low is 60 ms;
//the next 2 parameter(10): number of data you will sent;
//the next parameter(1, 2, 3, 4,5,6,7,8,9,10): data you will sent ;
void loop()
{
IR.Send(d, 38);//sent the data via 38Kz IR
delay(1000);
}

Et pour le recepteur :
//**************
//IR sent demo v1.0
//Connect the IR sent pins to D3 for this demo
//By:http://www.seeedstudio.com/
//******************************
#include <IRSendRev.h>

void setup()
{
//enableIROut(38);
}
//unsigned char d[] = {9, 90, 91, 11, 31, 4, 1, 2, 3, 4};
unsigned char d[] = {15, 70, 70, 20, 60, 10, 1, 2, 3, 4,5,6,7,8,9,10};
//Very Important:
//the first parameter(15): the data that needs to be sent;
//the next 2 parameter(70,70): the logic high and low duration of "Start";
//the next 2 parameter(20,60): the logic "short" and "long"duration in the communication
// that to say: if "0", the high duration is 20ms and low is 20 ms; while logic "1",
// the high duration is 20 ms and low is 60 ms;
//the next 2 parameter(10): number of data you will sent;
//the next parameter(1, 2, 3, 4,5,6,7,8,9,10): data you will sent ;
void loop()
{
IR.Send(d, 38);//sent the data via 38Kz IR
delay(1000);
}
Mais à priori ce n'est pas du Python...
Est-ce transformable en python???
D'avance merci

Re: Transcription de ? en python

Posté : mer. 15 avr. 2015 22:30
par Manfraid
Je veux bien t'aider mais le soucis c'est qu'il manque l'appel de la biblioteque irsenrec.h et sans celle si on 'r peu t'aider

Re: Transcription de ? en python

Posté : mer. 15 avr. 2015 22:41
par lawfix
Hello,

A priori cela ressemble à du C.

Pour transposer en python il va te falloir vérifier la transposition de la librairie, si celle-ci est dispo pour python.

En outre, je suppose que ton pi va jouer le rôle de récepteur, mais ton émetteur c'est un arduino ?

Re: Transcription de ? en python

Posté : mer. 15 avr. 2015 23:37
par speedi57
Les deux code sont de l'arduino, c'est le fichier IRSendRev.h qu'il faut traduire en python et adapter les io arduino en io du raspberry pi.
Donc pour pouvoir t'aider on aura besion de ce fichier

Re: Transcription de ? en python

Posté : jeu. 16 avr. 2015 20:53
par Thesey62
Merci de votre bonne volonté...
Je vous explique mon problème.
Pour le Bac, je dois réaliser une maquette avec un déclenchement de chrono au top départ et son arrêt au passage de bateau, à la fin de la course au passage entre des capteurs.
J'ai une carte Raspberry Pi
J'ai acheter des capteurs :
Un émetteur IR Grove WLS12148P
et un Module récepteur IR Grove WLS12136P
Mais je n'ai pas de programmation.
En cherchant sur le site du revendeur Gotronic j'ai trouvé les écritures que je vous ai copié-collé.
Mais ou puis-je trouver ce fichier IRSendRev.h ?
Merci de votre aide

Re: Transcription de ? en python

Posté : dim. 26 avr. 2015 12:09
par smba38
Bonjour Thesey62,

Il existe une librairie python pour les modules Grove.

http://www.dexterindustries.com/GrovePi ... mentation/

Pour le fichier IRSendRev.h faire une recherche dans le moteur de recherche Google avec les mots clefs

IRSendRev filetype:h

https://github.com/Seeed-Studio/IRSendRev
https://github.com/Seeed-Studio/IRSendR ... RSendRev.h

Il existe des package python pour gérer les capteurs infrarouge
https://pypi.python.org/pypi/python-lirc/1.2.1
http://randomtutor.blogspot.fr/2013/01/ ... ry-pi.html

Par contre je n'ai pas fait le test avec un capteur IR grove.

Cordialement.

SMBA38.