My little project involves a single servo sweep on an arduino stacked with an xbee shield that occurs when a single char is sent (I'll spare you the purpose for this). It works when I type the char on the other end in the xctu or other telnet environment, but won't when I try stacking the transmitting xbee on an arduino with pushbutton.
#include <SoftwareSerial.h>
SoftwareSerial XBee(2, 3); // RX, TXint ReadingNumber=0;
int button =3;
but won't when I try stacking the transmitting xbee on an arduino with pushbutton.
You mean that it doesn't work when you have the XBee and the switch connected to the same pin. I'm shocked, I tell. Just shocked. Hit it with a big hammer while you tell it to shape up!
debrouillez40:
I've tried an unused pin but to no success.
So, your switch doesn't even work, and you think its a programming issue. Please explain why you think that it is a programming issue. Please explain HOW you switch is wired and why you are doing it the hard way.
The switch works if I just get it to do a task like turn on a light.
Please explain HOW you switch is wired and why you are doing it the hard way.
It is wired in the way one would see in the "Pushbutton" tutorial.
I have no reference point as to "why I'm doing it the hard way". If I had the knowledge of different ways to do this, then presumably I wouldn't be doing it in the present way outlined in said tutorial.
How about just not responding any further, if you're going to be so unpleasant?
How about just not responding any further, if you're going to be so unpleasant?
How about you providing all the details UP FRONT, without referring to a bunch of tutorials that you can't even post a proper link to?
The simple way to wire the switch is to connect one leg to ground and to connect the other leg to the digital pin, with the internal pullup resistor enabled. Why anyone would wire a switch another way boggles the mind.
"The switch works" doesn't tell us anything.
Why are you sending the switch state only when there is Serial data to be read? Why are you only sending the switch state to the serial port? I was under the impression that you wanted to send the switch state via the XBee.
The simple way to wire the switch is to connect one leg to ground and to connect the other leg to the digital pin, with the internal pullup resistor enabled. Why anyone would wire a switch another way boggles the mind.
Why the ignorant (me, in this case) would do such a thing is.... because one is ignorant, which explains why I'm asking for help in the first place. How that's mind boggling? Well...
Why anyone would wire a switch another way boggles the mind.
Since I presume you respond to the posts of others who are rank amateurs, let me cue you in on something: the unlearned will grasp at what information is out there. If there is no prior experience or sufficient context, they will try what is available. Example: "Hmm, need to understand how the button works.....google 'Arduino pushbutton'..... OK, this looks promising.....I'll try that." I'm sure your intelligence and skills are formidable, but you may not be aware that that's how those lacking in sufficient skill, learning, and intelligence will often try to tackle simple technical tasks. Perhaps that will ease your amazement at my foolish posts.
There is no real "data" to be read, beyond an arbitrary symbol ("d", which would be sent by the button going high) that triggers the task to be done on the receiver end. Once again, it works if I use a telnet/xbee on a dongle to send the character.
I was under the impression that you wanted to send the switch state via the XBee.
That is indeed the goal, and I've tried tinkering with the syntax to make that happen, but to no success.