GithubHelp home page GithubHelp logo

Comments (4)

microbit-carlos avatar microbit-carlos commented on August 15, 2024 1

Quick clarification for the previous messages, as it gets confusing: uBit.io.face is a reference to uBit.io.logo, so it's a NRF52Pin instance.
On the other hand, uBit.logo is the instance of TouchButton.

Okay, so as we have the wasTouched() method available in uBit.io.logo and the touch type (capacitive vs resistive) can be independently configured, I believe we can do everything in MicroPython land via uBit.io.logo.

It does make sense to also add wasTouched() to TouchButton`, but rather than drag this around more, let's just go with what we have at hand.

I'll mark this as complete.

from codal-microbit-v2.

microbit-carlos avatar microbit-carlos commented on August 15, 2024

TouchButton objects are only used internally within NRF52Pins and the uBit object exposes all pins, edge connector or otherwise as Pin objects

Yes, but the main way to use the touch logo is via uBit.logo which is a TouchButton:

TouchButton logo;

from codal-microbit-v2.

microbit-carlos avatar microbit-carlos commented on August 15, 2024

@dpgeorge from your comment in:
#251 (comment)

I think wasPressed() was only added to the NRF52Pin object, but not to the TouchButton() class?

I assume you meant wasTouched() as that's the method that was added to NRF52Pin and not TouchButton?

TouchButton should already contain a wasPressed() method, is that something you can use? (uBit.logo.wasPressed() already exists)
Or do you need a wasTouched() method as well in TouchButton? (uBit.logo.wasTouched() doesn't exists right now)
If you need a wasTouched() method would you be able to use the uBit.io.face.wasTouched()? (uBit.io.face is an NRF52Pin instance)

from codal-microbit-v2.

dpgeorge avatar dpgeorge commented on August 15, 2024

I assume you meant wasTouched() as that's the method that was added to NRF52Pin and not TouchButton?

Yes, I meant to say wasTouched() was only added to the NRF52Pin object.

TouchButton should already contain a wasPressed() method, is that something you can use?

I tried using this but it doesn't seem to work, it always returns 0.

If you need a wasTouched() method would you be able to use the uBit.io.face.wasTouched()?

The code currently uses this (it uses uBit.io.logo.wasTouched()) and that seems to work. But I was under the impression this uses resistive touch and instead it's better to use TouchButton::wasPressed(). But maybe I'm wrong here. If it's correct (electrical behaviour wise) to use uBit.io.logo.wasTouched() then I'm happy to do that. That means all the touch objects use the same code, they all use NRF52Pin::wasTouched(). And that's how the code currently works, so there would be nothing to change if this is the correct way to do it.

from codal-microbit-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.