ev3ios icon indicating copy to clipboard operation
ev3ios copied to clipboard

touch sensor

Open ludovicgrimbert opened this issue 8 years ago • 3 comments

hi, How to work touch sensor and others sensor (not motors), little example if you can ...

ludovicgrimbert avatar Dec 11 '17 07:12 ludovicgrimbert

Hi, i never tested the the ability to read sensor values and since i don´t own a Mac or EV3 anymore, i´m not able to test it.

What you can try is, to play around with the Ev3DirectCommand.readyRaw() function. It should give you the raw data from the specified port.
On the LEGO homepage there is an developer guide (download the EV3 Firmware Developer Kit). Interesting parts should be section 4.8 and section 5.

Example: (Note: not tested and maybe no correct syntax!)

brick?.directCommand.readyRaw(port: InputPort.one, mode: 0, { (receivedRaw: NSData?) in
    if (receivedRaw != nil) {
        ///Use the data here
    }
})

Good luck!

andiikaa avatar Dec 11 '17 10:12 andiikaa

Thanks ! I'll try it !

ludovicgrimbert avatar Dec 11 '17 12:12 ludovicgrimbert

Thanks ! I'll try it !

Hi, Do you work out anything on the senors? If you did can you share with me how did you done it?

Thank you !!

sean218 avatar Jul 29 '20 14:07 sean218