You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • @Abhigkar

    this is about the mainline I would go: If there is no (Espruino) JS module yet for connecting / talking to Azoteq IQS263 Capacitive Touch sensor, take the Arduino code and put it into a module.

    How would that go? ...take a peek at other modules talking I2C to sensors.

    In addition to the .connect(...) that sets 'all' up includes in its arguments the pin you connect to the sensor 'RDY' pin and callback for handler in the application level. In setup process at last you add a setWatch(callback,rdyWatchingPin,<optionĀ­s>).

    Their are variations of this: you may crate a start and stop listening - like .enable(boole) on the connection module instance to let application control when to be called rather than put all into the .connect().

    You can always let the application do all things. On the other hand, you would like to put as much 'low level' handling into the module, for example: detection of short touch, long touch, etc., and pass that in the callback or make even different callback with this information, including time, touch time, last time, etc. To get some ideas, look at the Espruino event object.

    For the programming paradigm, do not think server-side JS, like nodeJS, but more browser JS as you are very familiar with and threat the sensor like a html ui action element, for example, as a button, or a canvas where you clicked on and you get tons of info with the event that is delivered to the attached event handler(s).

    Enjoy the ride!

About

Avatar for allObjects @allObjects started