Asked — Edited
Resolved Resolved by Dunning-Kruger!

Trying To Use An Adc Port For Pir

I am trying to use an ADC port to get the signal from a PIR sensor.

I have in my script:

$PIR = GetADC(A7)

and I get this error message;

Error on line 26: Missing String Quotes or Invalid Expression: A

Is it possible to use this port for this purpose? If so, what is the proper syntax to use it?


Skip to comments


Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!


Your syntax is incorrect, see below



What PIR are you using?... The one I have use digital, but they also will work on an analog port as well...


Thanks Richard, I am using a Radio Shack PIR


It should work on analog as well... but remember analog unlike digital (1 or 0) will report values between 0 and 255... So (you have to test this) a value of above 100 might indicate the PIR has been triggered... Like I said you have to test this with your PIR... I have a Parallax PIR and when I use it on analog it activates with a value of around 40 or so is reached... It is meant for digital, but it does work on analog as well...


If the value RX is a 10 you'll receive that error. If you TX from the EZ B 34,40 or 92 you will again receive an error. DJ knows about this I don't know if he's had a chance to look into it yet.


@mtiberia ... Ummm we're talking about a PIR detector on a digital and analog port not anything related to serial or the UART port....


I know but the issue shows up when trying to save to a file as well. I'm returning from out of town but if my guess is right it will show up when reading from a ADC port as well. I'll test it when I get home.


My bad, downloaded the latest issue of ARC and can now RX all unsigned integers 0 to 255. The only issues remaining are TX or saving 34,40 or 92 and that is the subject of a different post.