Go Down

Topic: How to control on off buttons (Read 5781 times) previous topic - next topic

Grumpy_Mike

What is this magnetic sensor?
It looks to be wired wrong.
You have not enabled the pull up resistor on the input pin.

Venki

no in our Arduino IDE basics> Button Read ordinary button circuit, instead of push button magnetic sensor acting as a push button.

Grumpy_Mike

It is not worth giving you advice if you are going to argue.
You know very little. I am telling you that sensor is wired up wrong. The button tutorial is also the wrong way to do things but that works.

So in the next post you can either tell what the sensor is ( the part number ), or I will not answer any more of your posts.

Venki

#33
Dec 03, 2014, 06:25 pm Last Edit: Dec 03, 2014, 10:17 pm by Venki
So in the next post you can either tell what the sensor is ( the part number ), or I will not answer any more of your posts.
Ohhh sorry sir, Don't mistake me,It dosen't have any part number Actually I went to local electronic shop and I asked them give a electro magnet sensor, they given me for less than 1$ rate.  I have attached the closed view. They,given me without box. I think it is also they are giving like LDR, piezo plate like that.

And,
The button tutorial is also the wrong way to do things but that works.
Can you tell me pls, button also like sensor is it, in sensors gate currents acting like a bridge and here in button physically we are bridging it, is it? So only you are saying button tutorial also wrong is it? else can you please explain me how it is wrong?  It is not argue I want to know that's it?

geraldpaxton

The picture posted appears to be a plastic covered magnetic reed switch commonly used in alarm systems...most likely normally open and when the magnet gets close it closes, if I was going to 'read' this with an Arduino I would tie one side to ground and the other side to a digital input AND to VSS through a 10k pullup resistor. In software make that digital input HIGH and read it...when the switch closes it will read '0' ie low,when the switch is open it will read '1' ie high and you can change the state of the Led as you wish with a HIGH or LOW written to the digital out the Led is tied to through a current limiting resistor.

Venki


runaway_pancake

#36
Dec 04, 2014, 02:18 am Last Edit: Dec 04, 2014, 02:19 am by Runaway Pancake
I would tie one side to ground and the other side to a digital input AND to VSS through a 10k pullup resistor. In software make that digital input HIGH and read it...when the switch closes it will read '0' ie low,when the switch is open it will read '1' ie high and you can change the state of the Led as you wish with a HIGH or LOW written to the digital out the Led is tied to through a current limiting resistor.
NOT both to "Vss" (which is Gnd).
Connect one lead to your input pin and the other to Ground; connect a 10K resistor from input pin to +5V (or use the "internal pullup".)
Then you would check for the digitalRead to be == 0 or 1 (LOW or HIGH)
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Go Up