How to Control a Ton of Inputs using Shift Registers!

Sdílet
Vložit
  • čas přidán 8. 04. 2013
  • This video explains how to use shift registers(74HC595) to control an insane amount of digital inputs.
    Part 2:
    • Part 2 - How to Contro...
    Check these videos out first:
    • How Shift Registers Work!
    • Video
    The code in the video: (note - I had the data and clock backwards in the video)
    www.kevindarrah.com/download/a...
    Check out my Tindie store (trigBoard is available) www.tindie.com/stores/kdcircu...
    Thanks to all the Patrons for dropping a few bucks in the tip jar to help make these videos happen!
    / kdarrah
    Twitter: / kdcircuits
    For inquiries or design services:
    www.kdcircuits.com
  • Věda a technologie

Komentáře • 280

  • @serverguy2
    @serverguy2 Před 9 lety +7

    I was a maestro of IBM 370/390 assembler. You are a maestro of at least Arduino coding. So maybe also C and others. Anyway, I appreciate your coding. Even with the quick hacks you write for these little demos, the code is still tight without being so tight to be incomprehensible like some C/C++ coders like to do. You show off just the right amount. It is easy to understand and "elegant" for demo level programs. I have seen MUCH worse. Thank you for taking the time to do these demos. I understand the electronics and have for decades but your integration with programming is enlightening at the next level of HW/SW integration. Well done.

  • @GIGLIndia
    @GIGLIndia Před 11 lety

    i was making 5*5*5 led cube using 595 shift register and bc 547 transistor. it worked in starting and is not working properly. i have not attached any resistor in the base emitter of transistor and 220 ohms in the collector emitter .CAN THIS BE A PROBLEM. or can you guess...

  • @lloydrmc
    @lloydrmc Před rokem

    Brilliant! Provision for debounce, (frequently not the case with shift register videos). Plus SPI library for speed.
    Lots of lateral thinking here. Earned you a subscription

  • @jzgonzo
    @jzgonzo Před 6 lety +4

    I'm not an electronic engineer but your explanation was pretty clear. Now i'm ready to solve a problem that seemed very complicated to me before watching this great video. Thanks!

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    yes, you have a good point, and I just added an annotation, but this does allow you to mix inputs and outputs in the same shift register bank

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    nice one! Thanks for the tip. I was just goofing around with these

  • @shedactivist
    @shedactivist Před 3 lety

    Perfect. I was looking for a way to use BCD switches as inputs to Arduino and you have shown me the way.

  • @EddieVanHalen1977
    @EddieVanHalen1977 Před 10 lety

    I am 2 minutes in and I already know I am going to subscribe. This guy is soooo good. Like butter. Thank you Kevin. Your presentation is just flawless and perfect. I cannot wait to watch many of your videos. Thank you so much. I am fan.

  • @BarrettSimms
    @BarrettSimms Před 9 lety +1

    This is really great. Thanks. It would be good to see how you wired everything up when you do these.

  • @codenothing
    @codenothing Před 8 lety

    Thank you so much for this video! you answered a lot of questions I had for my pinball project.

  • @wreckless_-jl6uu
    @wreckless_-jl6uu Před 4 lety

    *Very nice, I actually under stand shift registers a lot better now!! Specifically the 74HC595!! Thanks!!!*

  • @darktherapy
    @darktherapy Před 11 lety

    Cheers Kevin, you did a better video explaining this technique than in possibly could.

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    yep this will work for you... sounds like an awesome project! You may want to review the other comments below to see what others have suggested

  • @DOSTalks
    @DOSTalks Před 9 lety

    Just want to say man, really good video very clear and understandable you have a great channel

  • @JayDAnderson
    @JayDAnderson Před 10 lety +1

    Very efficient way to sense the actuation of any one or more of a number of buttons. Great. You are basically setting each button on a single bit then polling all the bits in the byte to see which one are on or off.

  • @mainkordormawblei
    @mainkordormawblei Před 6 lety

    thank you so much Kevin for that awesome video, can you do another for 74HC165? it would really helpful. thank you.

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    yes you are right! Ha, this actually got me as well! will update the code

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    yea, I know... I need to do that. Many people have suggested the same. Just been really busy lately

  • @1Joren
    @1Joren Před 8 lety

    Erhm honestly thanks for showing that circuit with the analogRead at the start. That'll actually do for my project since it's only 4 buttons I'm using and they shouldn't/can't be pressed at the same time in my interface. I'll definitely start playing with shift registers in the future though when time is a less pressing issue :P

  • @fierdawsbugiez
    @fierdawsbugiez Před 3 lety

    Tq for the detail explanation,..about to build something and learning for shift reg, already watch many vid n good input

  • @funy0n583
    @funy0n583 Před rokem

    first he says he's going to assume we understand how shift registers work and then he says "I'm sure if you guys are familiar with diodes or not" haha I appreciate you explaining everything

  • @The1wsx10
    @The1wsx10 Před 8 lety

    very nice video. i only have a basic knowledge of what different components do and i was able to understand this very clearly

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    I think you just inspired me to make a followup video!

  • @souravdokania1929
    @souravdokania1929 Před 8 lety +1

    This did blow my mind, it was so awesome. I could have never imagined such an amazing technique was even possible.

  • @TexasSkyPilot2
    @TexasSkyPilot2 Před 10 lety +1

    Good explanation of good design. Cinematography should be front lighting to remove glare from back light on desktop.

  • @luw1z
    @luw1z Před 10 lety

    Thanks alot for the explanation. I was wondering if you have the part numbers for the diodes you used?

  • @chemistry7699
    @chemistry7699 Před 10 lety

    Thank you. I now more fully understand how CCDs work by shifting the data.

  • @PihkalTheTihkal
    @PihkalTheTihkal Před 11 lety

    I was going to ask why you didn't use a regular parallel in - serial out shiftregister but since multiple people already asked it I'm not going to ask it again.)
    It's actually a pretty neat technique that I've never seen before so thank you for explaining it.
    Using outputs as inputs if that's not thinking outside of the box, I don't know what is.
    Great video, as always.

  • @thebackyardguru3785
    @thebackyardguru3785 Před 10 lety +2

    Awesome tutorial, any chance i can get a schematic.. been at it for a week and i just cant get it to work. I am from South Africa, not sure where i am going wrong... difference in IC maybe... PS i am still a newbie, what is the best way of trouble shooting where i am going wrong?

  • @bergweg
    @bergweg Před 11 lety

    I was about to post the same question. The 74HC595 is a Serial to Serial/Parallel IC, I'd use a Parallel to Serial IC with internal pull-up resistors.

  • @electrik0
    @electrik0 Před 9 lety

    Great video, Thanks for sharing!

  • @nerdyneddy7887
    @nerdyneddy7887 Před 11 lety

    As you had as a baloon at the start, a parallel in serial out is the way ti go for input. 3 pins, clock, load & data.
    cheers

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    my code was to simply toggle the LED on or off, but if you just need to read the value in as being just on or OFF, that is simple, since a double tap wouldn't affect you. Like the ISR being called would not flip your output

  • @avdwio
    @avdwio Před 11 lety +2

    Methinks an array or two would help to clean up the code.
    You could remove the while loop at the end and repeat the pin read function without actually writing to the leds. Run pin_read, get an array for which buttons are pressed, compare it to the array for the buttons which were previously pressed. From that you can find which buttons have gone from 0 to 1. If nothing's changed, there's no difference, so pin_read can just keep looping while the input is high.

  • @Lefterhs15
    @Lefterhs15 Před 8 lety

    Thanks man. Really helpful !

  • @ThirdPer3on
    @ThirdPer3on Před 6 lety

    Love your work!

  • @KJ7JHN
    @KJ7JHN Před 5 lety

    Complete awesomeness! Thank you.

  • @ImaginationToForm
    @ImaginationToForm Před 11 lety

    Hi,
    Very useful information. I wasn't needing thousands but I am going to be making a control panel for a spaceship game I play to make it more interesting to play than just keyboard. Going to use different switches and types of lights. Was probably needing about 20 inputs and more outputs. Was going to add extra just to give it more of a spaceship feel too :) I thought I was going to have to use analog multiplexers for input but I guess I can just use the shift registers now.

  • @geraldmoritz8523
    @geraldmoritz8523 Před 8 lety

    Great Video ! I want to use a Rotary Encoder and need the Interrupt for this one. But I could use any PinChangeInterrrupt for checking any pressed button, right ? Greetings from Austria !

  • @JurriaanPetersen
    @JurriaanPetersen Před 11 lety +2

    The while loop at the end of the ISR should not be necessary, if the IRS is only called on the rising edge. And if you did want to improve your code(or make it shorter) you could also replace the whole check variable by replacing it with "1

  • @yorgle
    @yorgle Před 10 lety

    This is remarkably similar to how a Diode Matrix Rom works. Very clever!

  • @user-zg6qh1bk8y
    @user-zg6qh1bk8y Před 5 lety

    Hey I appreciate the video, but it would be very helpful to beginners like myself to have a schematic. Is there a wiring diagram that you could share with us??

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    hmmm, maybe? I think there might be a way to modify what I have here for something like that, but this is interrupt driven, so if you only care about a reading above a threshold then yea, I think this coudl work

  • @anuragmahajan5919
    @anuragmahajan5919 Před 3 měsíci

    Thanks, that was very helpful!!!

  • @oscareriksson9414
    @oscareriksson9414 Před 5 měsíci

    Cool trick! I was thinking of letting the last output shift everything back to the micro controller. As in insted of connecting another shift register in series, I would connect it back to the arduino in this case. There I would shift the bits into a byte and after the 8 clocks I would have the output byte back and could mask for the correct buttonpress. I figured it would maybe work since it shifts out from there. But maybe your loop is better hmm I'll try and see. This gave me inspiration! Thanx

  • @DeeegerD
    @DeeegerD Před 9 lety +30

    Good button technique but all those delays in an ISR is very bad practice. You should only record the state of the buttons into variables and let the main loop process debounce and determine if the buttons have been pressed. Another way is to check a clock state and determine if the button has been pressed long enough in the ISR and set a state. The objective is to manage the button state as quickly as possible in the ISR and return to the main loop (rest of the code).

    • @DupczacyBawol
      @DupczacyBawol Před 6 lety +2

      Agreed, but the author was saying he had not prepared himself to the video, and he appologized to us. As for ISR, indeed the 'routine' (not function) should only set some flag to true/false, and that is all. Hardware interrupts work aside normal program execution. MC/CPU stops normal program execution for checking all that interupt stater and running ISRs. And I think unless the current ISR() routine finishes it halts executing next ISRs, thus stops running the code and other interrupts (timers?). I think, such behavior prevents also from multiple execution of the same ISR over, and over again berore the first one finishes. (we would experience interrupts interrupted by interrupts - endless loop). The loop function should do the job. Anyway great lecture, thank the author. Have a nice day.

    • @Gilhad1
      @Gilhad1 Před 6 lety +1

      You are right, but purpose of THIS video was not ISR, but the button/diode/pin 2 trick, no more. So the code is just as demo, how it is possible to read that, not how it should be done in "real" program and even waiting in ISR does not matter, as there is no other code to execute, nor other interrupt to take care of.

    • @HDFoxra
      @HDFoxra Před 5 lety

      @@DupczacyBawol As pointed out, yea... this has nothing to do with ISR or anything like that. And even if he apologized for not being prepared to make a video... if you haven't prepared, why make the video? Lol. EVEN then, again, being prepared for a video has nothing to do with implementation. I could set up 20 servers for a business, but then go 'I wasn't prepared to give an orientation on how to use these servers', and yet that orientation would have NOTHING to do with me actually installing an OS onto the hardware and installing the necessary drivers/software...

  • @deltasecurity7135
    @deltasecurity7135 Před 10 lety

    Hello Mr.Darrah , Kevin ,
    First of all , congratulations for you excellent job. That being said , I wonder if you can post a tutorial with the wiring diagram of the circuit, because I tried several times and could not make it work.
    Thank you in advance.
    Wagner Hiroshi

  • @alexstone691
    @alexstone691 Před 9 lety +2

    You are the best dude!!

  • @bwoogie
    @bwoogie Před 7 lety +1

    The diodes are required if anyone is wondering :) I didn't have any on hand so I just used some LEDs! for testing purposes, anyways.

    • @AnimilesYT
      @AnimilesYT Před 5 lety

      Aren't LEDs horrible diodes? I have no facts to back it up, but I've heard that LEDs were made to emit light, and not to block the current. But if it works for testing purposes then I don't really see a problem either xD

  • @flyingsquirrel3271
    @flyingsquirrel3271 Před 5 lety +3

    This is so cool! Thanks for explaining!
    And also: Fix your indentation!!! :-P

  • @danielguevara9357
    @danielguevara9357 Před 8 lety

    exellent thats the best tutorial ever been made

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    yea they are, but no prob since we are debouncing in software. A simple delay is all that's needed

  • @FreeApophis
    @FreeApophis Před 10 lety +1

    That is pretty neat.
    However for a thousand inputs it would probably be a good idea to be a bit more efficiant: You could make this even faster by divide and conquer instead of a linear search. For 1024 Inputs you only would need 10 checking cycles compared to 1024 in the linear search.

  • @Leo.Martins
    @Leo.Martins Před 3 lety

    Thank God. Finaly found what i've needed!

  • @cjmendoza8599
    @cjmendoza8599 Před 5 lety

    @kevin darrah sir im asking for help do you have a schematic diagram of 4 or 5 or more inputs interlocking circuits...for example i have a four inputs push button 1 to 4 and output LED 1 to 4 the sequence is like this..if i press push button 4 the LED4 will turn on then when i press push button 1 the LED 4 will turn off then the LED 1 will turn on then when i press push button 3 the LED 1 will turn off then LED 3 will turn on and so on..it always one LED will acivate on OUTPUT...please...thanks in advance

  • @MrManuHeel
    @MrManuHeel Před 7 lety

    Hi Kevin ! I'm working on a project using your setup (actually, using the "piano" version as it's exactly what I'm trying to achieve), and I can't figure out something. I don't get the usage and difference between the data and what you call "Input from the buttons" (pin 2). What exactly is this pin 2 doing and how to connect it to my buttons ? We can't really see the board or schematics in your video :/
    Thanks !

  • @mbrumlow
    @mbrumlow Před 10 lety +2

    I am just getting into Arduino, but have experience with programming.
    I was just wondering about your code a bit.
    I was thinking that it may be better to make pen_read set a global boolean, then in your loop you would do basically what you are doing in pen_read right now.
    loop would be while(pressed) { *current_pen_read_code*; pressed = false; };
    Like I said, I am new, and don't have the parts to test this yet. Can you think of why that would not work, or why that would be less effective?

  • @doomaster4
    @doomaster4 Před 10 lety

    Have you tried connecting this to the arduino in your cube to change the animation that is running?

  • @Yefatbastard
    @Yefatbastard Před 8 lety +4

    Diodes are like check valves, they only allow current to flow in one direction..

  • @markpedretti3765
    @markpedretti3765 Před 6 lety

    I'm looking for something similar but I need to press a button and it will turn off the other. it's possible?

  • @T-FLoWW
    @T-FLoWW Před 6 lety

    Hi. I have a working circuit which has 4 digit 7 segment led display. I want to to read the Data and make my arduino send Smae numbers to my serial monitor tgat what my segment display shows simultaneously. What u wld advice? And umm this segment display has total 12 inputs which 8 for leds and 4 for shifting from eacg 1 number block cathodes(or anodes). Any advice?

  • @zelra891
    @zelra891 Před 9 lety

    thanks. clear video on how it works. but i'm not familiar with SPI, so the code is a little hard to understand.

  • @Gator198l
    @Gator198l Před 9 lety

    Kevin, how is this wired? I'm having problems getting this set up. Thanks.

  • @geertvancompernolle2586

    Yes, this is an old thread, but still very, very useful. The technique to find out which buttons are pressed is super! And this, with a 595 which is supposed to drive something, not to (indirectly) detect if something is changed/pressed... Very clever indeed...
    Problem is that I don't know which Arduino has been used for this demo (if an Arduino has been used at all) but I struggled with the SPI communication because with the Arduino Uno, the clock and data pins are switched. In my case, the clock pin is Arduino pin 13 (and not 11 as per the tutorial) and the MOSI pin is Arduino pin 11 (and not 13 as per the tutorial). In the video where the code is explained (e.g. time 12.14) it's mentioned otherwise. Unless the comment written next to the pins is wrong, in which case I step back silently...
    Can this be confirmed?
    Best,
    --Geert

  • @adriancastellanoszaragoza5878

    Awsome tutorial

  • @hyperscitic92a
    @hyperscitic92a Před 10 lety +16

    Could you please post schematic of this circuit on your website. I understand shift registers pretty well but I'm a bit confused how you wired this project up.

  • @edgarestebanroseroarmas2774

    Amazing technique!

  • @YoussefEl.
    @YoussefEl. Před 8 lety

    How would you apply the same principle for an analog signal ? The Arduino has only 6 analog inputs, what could we use to extend that to say 20+ analog inputs?

  • @SkyhanViper
    @SkyhanViper Před 8 lety

    u can use data lactches for same porpose.
    74hc374
    no code needed.
    just use external data read command
    74138 demultiplexer will also help u for more inputs

  • @unity4alle1
    @unity4alle1 Před 2 lety

    Hi Kevin, I am trying to figure out how to make simple led selection indicator, so I want 8 LED to be shifted in an infinite loop by a press of a button. So one press next LED is lit, another press next to last LED is lit and so on in circle. I hope you understand what I want to do. Please help, thank you :)

  • @Psykamaholik
    @Psykamaholik Před 8 lety

    Just wondering if you could offer suggestions as to why this code works on an UNO but not on a mega2650? I've tried changing the pins in the code to the appropriate MOSI and SCK pins on the mega but still no luck. Any help appreciated

  • @korbanomalley7002
    @korbanomalley7002 Před 10 lety

    I am relativity new to programming shift registers. How could I modify this code to use only 1 register for inputs and then do something like print "high" to the serial monitor?

  • @priyabratasaha5385
    @priyabratasaha5385 Před 7 lety

    Great idea BOSS!

  • @13firebug13
    @13firebug13 Před 10 lety

    Is there a reason why I can't get my led circuit, the circuit is from a double ended light saber thing that have I think 6 leds on one circuit that has one + cable for each and one - cable for all of them.

  • @iam.masoudsamimi
    @iam.masoudsamimi Před 4 lety

    Do you have schematics/diagrams for the connections please?

  • @thomasthiry4293
    @thomasthiry4293 Před 5 lety

    Hi! Does all this can work on a raspberry pi (and domoticz)? Thanks :)

  • @htkevo5273
    @htkevo5273 Před 5 lety +1

    I think u can also use a 74165 parallel in serial out that has its output pin hooked to DS of the 74595 to achieve this

    • @LikeVHD
      @LikeVHD Před rokem +1

      I think. If using 74165 then no need to use 74595 anymore. It is possible to connect the push button directly to the 74165 to reduce complexity. The rest is just programming.

  • @Ademan
    @Ademan Před 10 lety +2

    Nice walkthrough. On the software side you should be able to replace your bitRead()/bitWrite() with just Output ^= Check; Someone's probably already brought it up but I have no desire to fight youtube's comment system long enough to make sure...

  • @abdoubobo7763
    @abdoubobo7763 Před 2 lety

    Thank you so much Kevin. Please i need the diagram?

  • @10magicalfingers27
    @10magicalfingers27 Před 4 lety +1

    Hi Kevin, I'm trying to make a small simple midi keyboard with 25keys (nothing fancy, just digital switches reading on and offs and sending the data to the computer) . I just need it to be polyphonic upto 10keys. I.e it should be able to detect (on or off) for 10 keys at them same time. And it should be very responsive in reading it. Are multiplexers okay or shift registers? Which shift register do I need need. And i saw you pressing multiple buttons at once. How many can actually be pressed at the same time and still work in your setup.

    • @Obzy98
      @Obzy98 Před rokem +1

      Hey @10magicalfingers27
      I'm curious to know if you got a solution for your project. Did it work? And do you mind sharing your thoughts?

  • @german.galvis
    @german.galvis Před 6 lety

    I couldn't find schematics for this in your site! are those published anywhere else? :O :O

  • @maniamone
    @maniamone Před 3 měsíci

    hi, are you using two 74HC595 for both controlling inputs and outputs? and is it possible to have the circuit schematic of this tutorial?

  • @dadholly3133
    @dadholly3133 Před 10 lety

    Can a automatic style casino keno game be made up with Arduino or some micro controller. It would show game number as well as drawing 20 random numbers out of 80 leds.

  • @Neslekkim
    @Neslekkim Před 11 lety

    The buttons you are using here, are they not giving you any bounceproblems?, if so, what buttons are they?

  • @Kevindarrah
    @Kevindarrah  Před 11 lety

    yea that's a good idea, I still need to bust out my pi and figure out how to work with it

  • @ArturBernardoMallmann
    @ArturBernardoMallmann Před 7 lety

    Basically the register connected to the buttons just send one bit per cycle to identify if the actual checked button is pressed!? This a is a amazing idea.

  • @chadjamesjohnson
    @chadjamesjohnson Před 11 lety

    Hey, I'm curious. What microcontroller are you using in this video?

  • @ClokworkGremlin
    @ClokworkGremlin Před 5 lety

    So it's basically a ghetto MUX, which is pretty cool if you don't have an 8-to-1 MUX lying around, but the really interesting thing about this is that since you're strobing the source voltage across the pins, it should actually work with analog inputs as well as pushbuttons. When you do the strobing pass, the pulldown resistor will reduce the voltage across the inactive pins to 0, so you can theoretically get the voltage across only one input at a time.
    You may need to do some resistor math to figure it out exactly. It's been a few years since I had to calculate circuit diagrams, but could be especially useful if you have a limited number of ADC pins available.

    • @ClokworkGremlin
      @ClokworkGremlin Před 5 lety

      Back to say: I just tried this, and it actually works way better than I expected, but not exactly how I described 2 months ago.
      Your analog inputs each have one reference pin tied to VCC or ground, depending on whether you want them to be active-high or active-low. (VCC for active-low, VSS for active-high)
      The other reference pin is tied to the shift register, and is strobed through just like in this example (or the later one where he switched from ISR to polling)
      Analog values are connected to a single analog pin via a diode. If the circuit is set up in Active-High mode, the diodes should be pointing *from the analog sensor into the MCU analog input pin.* In Active-Low mode, point them the other direction.
      The analog pin will read whatever the highest/lowest (depending on mode) value among all of the analog sensors is. By setting the shift register pin to inactive mode (low for active-high, high for active-low), you effectively remove that sensor from the circuit. Set only one sensor active at a time and strobe through them to read 8 analog values on a single input pin.

  • @avtargrewal7422
    @avtargrewal7422 Před 7 lety

    Hi Kevin .I am working on project where I need to switch on /off 16 LED with 16 switch with Arduino uno.Could you please show me how to edit the code for 16l LED's whit 16 switches

  • @Firashelou
    @Firashelou Před 11 lety

    hello, can you please put a fritzing picture or a schematic for the circuit ?

  • @avdwio
    @avdwio Před 11 lety

    So what happens if you're holding down one button and then press another? I'd assume that while loop at the end screws you over a bit there.

  • @charnjit525
    @charnjit525 Před 6 lety

    As any arduino board all pins can be used as digitalRead. My arduino Pro micro board has 18 pins for use as digitalRead. I
    Need to 42 pins for input to my arduino board(for different outputs) . Is it possible using 74HC595 shift register????? . If yes, please help me with arduino sketch & wiring diagram arduino board to 74HC595 and push buttons,,,,,,,

  • @MrXiaofanZhang
    @MrXiaofanZhang Před 11 lety

    Hi there,
    Has anybody got any tips/ advice for a relative beginner in electronics? I've got some basic knowledge about basic components(leds, resistors, caps) and the picaxe system. But I was wondering if there are any good websites or other resources that could help me broaden my knowledge/ understanding and work with more complex things with more integrated circuits driving a wider variety of outputs.
    Thanks.

  • @andrewalexander3079
    @andrewalexander3079 Před 10 lety

    Not sure if it works in the Arduino IDE, but just a suggestion for the future. In the for loop, instead of having the "Check" variable shifted and then run through the loop again, the parameters of the loop could be:
    for( Check = 1, Check >0, Check

    • @bjarnieinarsson3472
      @bjarnieinarsson3472 Před 9 lety

      Hmmm.. byte becoming -1, I thought bytes was unsigned number between 0..255 with values at every bit (seat) as follows.. 1 2 4 8 16 32 64 128. No minus for bytes.. at least in the language Pascal I use most of the time.
      Left shifting just shift value of bits to higher places, that is, race the value to power of two. You could also easily use 8 bit array values of bytes.
      When pushing two or more buttons, two or more hardware interrupts will occur. This "dirty" technics he is showing by overloading interrupt function in endless loop is very scary and against every thing I would even consider.
      Kind of challenge to optimize this, one idea is to save the state of prior interrupt's and use binary search, test first by using byte value of 15 (4 least bits signed) if no signal, then you know it is one of them who gives you 240, halve that and 3 readings is enough in worst scenario etc. and of cause take prior state of buttons in to those calculations with masking.

    • @lloydrmc
      @lloydrmc Před rokem

      @@bjarnieinarsson3472 wait, wut?
      By "-1" I think the conditional tests true in that instance
      And "Endless loop"? Where?

  • @serhioromano
    @serhioromano Před 8 lety

    Kevin, I would like to discuss one idea with you. How could I contact you?

  • @bitmeister
    @bitmeister Před 11 lety

    Wow, no dislikes, congratulations! Great vid!

  • @TheRossiale
    @TheRossiale Před 11 lety

    Can it be used for analog readings? :)

  • @TomLeg
    @TomLeg Před 4 lety

    What pushbutton are you using?

  • @Skandawin78
    @Skandawin78 Před 7 lety

    how many shift registers I need to control 25 key keyboard ? what is scan matrix? with 9*3 scan matrix can I control all 25 keys . how to set up that? pls advise

    • @Gilhad1
      @Gilhad1 Před 6 lety

      4 registers using this idea verbatim. to read matrix you need different aproach. Depends on many factors, what is the best, I woul use one mcp23017 over I2C for matrix up to 16 (rows+cols total)

  • @abdulrhmankhallil8254
    @abdulrhmankhallil8254 Před 9 lety

    Amazing... thanks a lot