RPI I/O Ext board

Posez ici vos questions d'utilisation, de configuration de DomoticZ, de bugs, de conseils sur le logiciel lui même dans son utilisation et son paramétrage.
Des forums spécifiques sont ouverts ci-dessous pour regrouper les différents sujets.
exosteph
Messages : 6
Inscription : 08 août 2015, 12:26

RPI I/O Ext board

Message par exosteph »

Bonjour,
Quelqu'un serait-il comment piloter cette carte dans domoticz ?
http://www.banggood.com/Unlimited-Casca ... 73018.html
fratton
Messages : 150
Inscription : 19 août 2015, 16:38

Re: RPI I/O Ext board

Message par fratton »

Des infos sur :
http://www.52pi.com/en/raspberry-pi/63- ... dule-.html
This module is designed specifically for the Raspberry Pi IO expansion Modules,which can effectively solve the Raspberry send IO port insufficient.Module uses four 74HC595 chips to expand 32 IO ports.As shown above, the top of the module will expand the IO of Raspberry Pi again that can be cascaded for more IO expansion modules can theoretically unlimited expansion.
Image

Exemple et code de test:

Code : Tout sélectionner

#include <wiringPi.h>

#include <stdio.h>

 int SER   = 12;

 int RCLK  = 10;

 int SRCLK = 14;

 unsigned char LED[8]={0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};

 void SIPO(unsigned char byte);

 void pulse(int pin);

 void init() {

     pinMode(SER, OUTPUT);

     pinMode(RCLK, OUTPUT);

     pinMode(SRCLK, OUTPUT);

     digitalWrite(SER, 0);

     digitalWrite(SRCLK, 0);

     digitalWrite(RCLK, 0);   

 }

 void delayMS(int x) {

   usleep(x * 1000);

 }

 int main (void)

 {

     if (-1 == wiringPiSetup()) {

         printf("Setup wiringPi failed!");

         return 1;

     }   

     init();

     int i;

     while(1) {

       for(i = 0; i < 8; i++)

       {

        SIPO(LED[i]);

        pulse(RCLK);

        delayMS(50);

        printf(" i = %d", i);

       }

       printf("n");

       delayMS(500); // 500 ms

       

       for(i = 7; i >= 0; i--)

       {

        SIPO(LED[i]);

        pulse(RCLK);

        delayMS(50);

        printf(" i = %d", i);

       }

       delayMS(500); // 500 ms

     }

     usleep(1000);

     digitalWrite(RCLK, 1);

 }

 void SIPO(unsigned char byte)

 {

     int i;

     for (i=0;i<8;i++)

     {

         digitalWrite(SER,((byte & (0x80 >> i)) > 0));

         pulse(SRCLK);

     }

 }

 void pulse(int pin)

 {

     digitalWrite(pin, 1);

     digitalWrite(pin, 0);

 }
Raspberry Pi B+ / RF-Link 433MHz / divers device maison 433MHz et Wifi
Répondre