You are reading a single comment by @Cale and its replies. Click here to read the full conversation.
  • Working on integrating a tool box for the work place that will provide some accountability to the user of the tool. The idea is to use the PICO, a MS146-2G Slot Reader (ID cards), a few magnetic holds and slew of TI CD4021BE. The drawers or cabinets will be locked by the magnetic holds, a user will use his ID card to gain access and remove tools from the drawer. Once closed the PICO will scan through and note what tools were removed. I plan to upload the information to a google spreadsheet with the ESP8266 of which I will build some code to send a text reminder to the users to return the tools at the end of the day. Here is the test code for the CD4021 so far.

    
    SPI1.setup({sck:A5,miso:A6,baud:9500});/­/pins 10, 3 respectively
    function loop(){
      digitalWrite(B1,1); // to pin 9 on chip, this allows the chip to collect its data for 20 milliseconds
      setTimeout(function(){
        digitalWrite(B1,0); // turn pin 9 off then........
        console.log("register 1 is "+(SPI1.send([0x00])>>>0).toString(2)); //collect data from first chip //I am not 100% on the 0x00 because I've tried other values and it still returns the same.
        console.log("register 2 is "+(SPI1.send([0x00])>>>0).toString(2)); //collect data from second chip
      },20);
    }
    setInterval(loop,1000);
    
    

    if CD4021 gpio 1 is on return 1, if gpio 2 is on returns 10, 3-->100, all three on returns 111, etc.

    Here is a diagram of how the chips are put together. Thanks to the work of the people at arduino.cc was I able to get this part together as some of this would be way over my head. Ill try to get some pictures on here as the project progresses. Thanks

About

Avatar for Cale @Cale started