Germany
Offline
Full Member
Karma: 0
Posts: 184
|
 |
« on: October 11, 2012, 12:30:49 pm » |
Hello, how to neither send 0 nor 1 on a digital output? My code (simplified): 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
Brattain Member
Karma: 137
Posts: 19030
I don't think you connected the grounds, Dave.
|
 |
« Reply #1 on: October 11, 2012, 12:32:33 pm » |
What don't you understand about binary?
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #2 on: October 11, 2012, 12:33:14 pm » |
how to neither send 0 nor 1 on a digital output? Tri-state it.
|
|
|
|
|
Logged
|
|
|
|
|
South England
Offline
Full Member
Karma: 3
Posts: 194
|
 |
« Reply #3 on: October 11, 2012, 12:34:04 pm » |
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
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #4 on: October 11, 2012, 12:42:56 pm » |
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
Edison Member
Karma: 65
Posts: 2246
|
 |
« Reply #5 on: October 11, 2012, 12:48:58 pm » |
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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #6 on: October 11, 2012, 01:03:38 pm » |
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
Full Member
Karma: 0
Posts: 184
|
 |
« Reply #7 on: October 11, 2012, 01:05:21 pm » |
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
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #8 on: October 11, 2012, 05:02:53 pm » |
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
Full Member
Karma: 5
Posts: 200
|
 |
« Reply #9 on: October 11, 2012, 09:38:02 pm » |
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
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #10 on: October 12, 2012, 03:55:07 am » |
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)
Online
Brattain Member
Karma: 276
Posts: 25492
Solder is electric glue
|
 |
« Reply #11 on: October 12, 2012, 09:38:48 am » |
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
Tesla Member
Karma: 71
Posts: 6820
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #12 on: October 12, 2012, 09:41:49 am » |
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
|
|
|
|
|
Cumming, Ga
Offline
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #13 on: October 12, 2012, 09:42:04 am » |
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
Edison Member
Karma: 65
Posts: 2246
|
 |
« Reply #14 on: October 12, 2012, 09:55:45 am » |
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
|
|
|
|
|
|