Interested to understand the nature of the digital IO pins, have been using PIN 0 to trigger an SMS when a PIR detects movement.
Once I got the s/ware working, I thought would simply strap the PIR to the board and simply connect the PIR data pin to the 1400 at port 0,, the end, as the PIR data port outputs 3.3V upon detection, all done....but PIN 0 appeared to pull the voltage down on the directly connected PIR?
This is really strange to me as I have found over the years that most IO ports are high impedance and require little omph to get them to change state
Not sure if I have bashed my board around some however I ended up having to buffer the 1400 input pin with a Darlington pair feed with 12V, and directly connecting the PIR output to the base on the first transistor. It works fine now but is not putting quite 3.X volts on the PIN, but is enough for the 1400 to pull PIN 0 high and SMS is sent
Am i missing something here? be great if someone could educate me?
but PIN 0 appeared to pull the voltage down on the directly connected PIR?
Have you got a connection between the PIR ground and the Arduino ground?
Is D0 set as in input pin with a pin mode?
What happens when you measure the voltage on this pin if you disconnect any external circuitry and set the pin as an input with the internal pull up resistors enabled?
I have it working, and basically tested it by connecting DO to the VCC pin to pull it high, of course measuring the pin when using it as an input with the PULLUP suffix yields 3,3v
/*
******************* SMS sender *************** JK 14/12/19 *******************
*/
Why pinMode(pin, OUTPUT)? Pins in OUTPUT mode are low impedance and then you write LOW to it. Why? And why every time round loop()? What's wrong with setup()?
If you want to use pins for input there are modes for that but OUTPUT isn't one.
Thanks for making me think about the pin mode command, as you may have guessed it works well once I config the port to be an "INPUT".... LOL all good, cheers JK
I am confused by that code. The pin variable seems to be initially assigned to 0, and then to the value of digitally reading the pin variable.
Are you trying to use this as an input or output or what?
It is most unusual to change the mode of a pin mid way through a program, almost as if you are trying to use it as an input and an output.
Have you a schematic of how you are wiring things up?
EDIT - seems to have been resolved while I was typing this.