PIR Sensor / Switch ON/OFF

This topic contains 2 replies, has 3 voices, and was last updated by  Zwartoog 5 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #12667

    ARNAUD.DAVID
    Participant

    Hello,
    I would like to add a Pir sensor to save the lamps, and I need some help to change the prog and switch on/off the nixies clock .
    currently the pir sensor is on pin 4 and sends me hight or low

    thanks a lot for your help.

    FirmwareVersion = “018300”;
    HardwareVersion “NCS314 for HW 2.2”
    6 tubes

    #12669

    Gra Afch
    Keymaster

    To turn off tube You need to send 64 bit of zeros via SPI interface.

    
    int nZero=0;
    SPI.transfer(nZero); //16bits
    SPI.transfer(nZero); //+16bits - 32bits
    SPI.transfer(nZero); //+16bits - 48bits
    SPI.transfer(nZero); //+16bits - 64bits
    

    I think the best solution is to change the function ‘void doIndication()’ at ‘doIndication314_HW2.x.ino’ file.

    #12685

    Zwartoog
    Participant

    Good idea! I made something similar. I used a sound meter so all hardware could be fitted in a chest. I added this function to the doIndication ino file. Looking at it now together with Gra Afch’s solution, the bitshifts are very useless 😉

    Not sure what the digitalWrite does though…

    
    void allNixiesOff()
    {
      // This is quite simple - just put everything to NULL
      digitalWrite(LEpin, LOW);
      unsigned long Var32 = 0;
      SPI.transfer(Var32>>24);
      SPI.transfer(Var32>>16);
      SPI.transfer(Var32>>8);
      SPI.transfer(Var32);
      
      SPI.transfer(Var32>>24);
      SPI.transfer(Var32>>16);
      SPI.transfer(Var32>>8);
      SPI.transfer(Var32);
    
      digitalWrite(LEpin, HIGH);    
      
    } 
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.