I am trying to make the Pir arudino sensor work with the Vex cortex. The problem is we can’t seem to get a value show up. Strangely enough the distance sensor was able to work, but not the motion sensor. Any ideas?
- I’m assuming this isn’t for competition since custom electronics aren’t legal for VRC
- Can you send some pictures or a diagram of how you have wired the sensor to the cortex?
Do you think that you can provide some pictures so we can help you easier?
I will be able to do it tomorrow.
Ok thank you, I will be there for help
Just glancing at PIR sensors (not a sensor I have used). I would try to configure it as an analog sensor and check it’s value as fast as possible.
I assume you don’t have an oscilloscope which would help you see what the data looks like much more effectively. Do you have datasheet for this exact sensor? How long is the pulse high vs low? If it’s say 1ms in length or greater then just reading analog value is probably fine. Faster and you might need to try to read it as digital pin.
Sadly there isn’t a way in any of the Vex software I know of to set up ISR s(interrupt service routines) which would be a more robust method of working with sensor that “pulses”.
Also you might need to apply an offset to any distance sensors you find vs what the vex software will report. The software is calibrated for the Vex distance sensor.
Distance = speed of sound * travel_time + overhead in sensor time
And their sensors have different overhead
You would need to use PROS or ConVEX, then you can setup interrupts.
I think I have mentally moved over to V5. I remembered ROBOTC definitely didn’t support setting up interrupts, should have guessed pros and convex exposed that to users.
Just wanted to make it more clear that we used the arudino to power the motion sensor and the distance sensor and then plugged it in with the vex.