• So you've got HRM_SDA/HRM_SCL/UARX/UATX - that's 4 pins?

    I don't know of others I'm afraid, but you could always look at using an I2C or OneWire IO expander? You could glue a chip to the PCB and then wire from that to the pins.

    OR if it's just for buttons, connect each button to one IO pin with a resistor to GND, then when you see the IO pin drop to GND in a setWatch, remove the watch, set the pin high and then lower it, and see how long it takes to hit 0 again, and the time taken will depend on the value of the resistor and hence the button.

    Something like:

    function buttonWatch() {
    setWatch(function(a) {
      PIN.set();
      setWatch(function(b) {
        print(b.time - a.time);
        buttonWatch();
      }, PIN, { edge:"falling"});
      PIN.read();
    }, PIN, { edge:"falling"});
    
    buttonWatch();
    

    If it works well enough then potentially you could even use 2^n resistor values so you can detect more than one button being held at a time

  • @Gordon, I was looking for easier and simple solution by using existing pins. I know, I'm lazy. :)
    Your suggested method with resistors looks very interesting. I will definitely try it. I was thinking to use a combination with diodes, but I will see which one works better.
    Thank you Gordon for sharing your brilliant ideas as always.
    I will try a few approaches and report back.

About

Avatar for JeonLab @JeonLab started