JE-Random-Tech / ProJEcts

All code to the JE Random Tech Videos can be found here
0 stars 2 forks source link

IR sensor instead of button #8

Open CShouse1970 opened 1 year ago

CShouse1970 commented 1 year ago

I'm looking for the coding to trigger each video using IR break beam sensors instead of the momentary buttons. Would this be a simple code change?

JE-Random-Tech commented 1 year ago

That depends on how the IR ports work. The Button just connects to the specified pin and ground. This https://github.com/JE-Random-Tech/ProJEcts/blob/e421b75c9b155efdbf32875456d9ddc76ed2246d/Haptic%20Board/HapticBoard.py#L118 loop sets up the internal pullup so when the button is pressed the signal is set to ground and thus a falling edge is specified to trigger a new video. So if you are lucky you might not have to change the code at all or only slighlty modify it given that the sensor has a simple digital output port.