Canada
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?

Thanks


ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

#1  

Your syntax is incorrect, see below


$Pir=GetADC(ADC7)

#2  

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

#3  

Thanks Richard, I am using a Radio Shack PIR

#4  

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...

#5  

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.

#6  

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

#7  

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.

#8  

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.