Pages: [1] 2   Go Down
Author Topic: neither send 0 nor 1 as digital  (Read 1536 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Full Member
***
Karma: 1
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

how to neither send 0 nor 1 on a digital output?

My code (simplified):
Code:
pinMode(5,OUTPUT);
digitalWrite(5,HIGH);

This is for a transmitter and I don't think that sending LOW is the same as doing nothing...

I want to do the same as cutting the line would do.

Thank you
Logged

using Arduino Uno Rev 3

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26626
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What don't you understand about binary?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
how to neither send 0 nor 1 on a digital output?

Tri-state it.
Logged

South England
Offline Offline
Full Member
***
Karma: 3
Posts: 205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If your transmitter has a chip-select / enable pin, use that to turn it off when you're not transmitting. Is that what you're after?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 49
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, in digital devices something is either 0 (low/false) or 1 (high/true). It cannot be both, and it cannot be neither. However, if you don't want to output anything at all on a pin, set the pin as an input. That way the arduino won't drive the connecting pin. This means some other device can set the pin level. If no device drives the pin, its state is undefined (it can be anything and everything). Digital things don't like undefined (undefined is not a number), so you may want to avoid that last situation.

Pieter
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5744
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, in digital devices something is either 0 (low/false) or 1 (high/true). It cannot be both, and it cannot be neither. However, if you don't want to output anything at all on a pin, set the pin as an input.

Set the pin as an input AND turn off the pullup resistor by setting the output to 0.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Newbie
*
Karma: 0
Posts: 49
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, in digital devices something is either 0 (low/false) or 1 (high/true). It cannot be both, and it cannot be neither. However, if you don't want to output anything at all on a pin, set the pin as an input.

Set the pin as an input AND turn off the pullup resistor by setting the output to 0.


Yep, unless you want the pin to default to 5V that is.
Logged

Germany
Offline Offline
Full Member
***
Karma: 1
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Set the pin as an input AND turn off the pullup resistor by setting the output to 0.
That's good!
Thank you very much.

Logged

using Arduino Uno Rev 3

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Set the pin as an input AND turn off the pullup resistor by setting the output to 0.

The part after "AND" is not necessary.
Logged

Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 515
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What type of Transmitter is being used?
If its a simple ASK Transmitter , then leaving the data pin in a high impedance state can cause the
transmitter to intermitantly transmit , as the voltage on the pin will float around.
Much better to leave it with a 0 on the data pin.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe not exactly what you are looking for, but check this forum post.

Moderator edit: removed quotes from URL
« Last Edit: October 12, 2012, 04:00:24 am by AWOL » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Set the pin as an input AND turn off the pullup resistor by setting the output to 0.
That's good!
Thank you very much.
While that is correct what ever you are doing I don't think you need to do this at all. If you are connecting the pin to the input of another chip you do not want it floating as it is called.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 130
Posts: 8620
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What don't you understand about binary?
That there are only 10 types of people in the world...those that understand binary and those that don't.

Yeah I know, it's an old one, but it still cracks me up.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1661
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To me... *floating* means... I will allow the mysterious spirits of the Ether and Paranormal to decide the fate (state) of the pin in question.  (or let my finger decide)
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5744
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Set the pin as an input AND turn off the pullup resistor by setting the output to 0.

The part after "AND" is not necessary.


Nope. It's definitely necessary.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Pages: [1] 2   Go Up
Jump to: