How sensitive is touch sensor


#1

running LEGO-Touch_Sensor_Test.py and the sensor returns one whether touch sensor is touched or not.

Is there a way to adjust sensitivity for BrickPi.Sensor ?


#2

nm on this – using ev3-Touch.py is the ticket. measures much more sensitive.


#3

Sorry, that’s right: one script works for the NXT touch and one for the EV3 touch. Did it work?


#4

Hello everybody,

i am struggeling at the moment with a simple problem. Atm i don’t have a BrickPi available, that’s why i couldnt exectue the example by myself =/ However, i hope you can help me.

My Question regards the Lego-Touch_Sensor_Debounce_Test example.

What does debounce in the case of the Python Lego-Touch_Sensor_Debounce_Test example mean? Is it a count function for how many times the button has been pushed or what does it do? What would be the return values if i push and release the touch sensor 4 times?

I would really appreciate your help, even I know it seems like a stupid question.

Thanks everyone.

In the attachement the relevant code:

from BrickPi import * #import BrickPi.py file to use BrickPi operations

BrickPiSetup() # setup the serial port for communication

BrickPi.SensorType[PORT_3] = TYPE_SENSOR_TOUCH_DEBOUNCE #Set the type of sensor at PORT_1

BrickPiSetupSensors() #Send the properties of sensors to BrickPi

while True:
result = BrickPiUpdateValues() # Ask BrickPi to update values for sensors/motors
if not result :
print BrickPi.Sensor[PORT_3] #BrickPi.Sensor[PORT] stores the value obtained from sensor
time.sleep(.01) # sleep for 10 ms


#5

Hey Thomas, I saw your post in another section and removed it. I can answer this here.

The debounce function filters out some faulty readings that can occur with a raw touch sensor reading. Arduino has a nice explanation of it here (https://www.arduino.cc/en/Tutorial/Debounce):

Pushbuttons often generate spurious open/close transitions when pressed, due to mechanical and physical issues: these transitions may be read as multiple presses in a very short time fooling the program.

If you ran this code and pressed the touch sensor four times, it would print “1” four times.

Hope that helps,

John


#6

Hello John =)

Thanks for your help. Yes it helped a lot.