Pages: [1]   Go Down
Author Topic: sending a train of data through digital I/O pins  (Read 83 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I am using an arduino UNO to communicate wireless to another board and my RF module http://www.ebay.in/itm/ASK-RF-Transmitter-and-Receiver-module-/221553116682?pt=LH_DefaultDomain_203&hash=item339598460a 
does the encoding and decoding on its own. It has 4 data lines and i need to transmit 8 different data through them.

I tried writing analog data to the lines and it wouldn't work.

Now i am trying to send a train of data bytes (binary) through the digital pins one after the other example for action 1, the code can be 101. So the digitalpin quickly sends 1,0,1 through the module and to the other board where i gather all the bits together and perform the required task!

The digitalWrite takes a long time to do this. For sending in three different commands, there is bound to be lots of lag. Any other way possible?
I have read somewhere that bitset works but i cannot find how. 
Logged

Global Moderator
Melbourne, Australia
Offline Offline
Brattain Member
*****
Karma: 511
Posts: 19350
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Using what code?

How to use this forum
Logged

http://www.gammon.com.au/electronics

Please post technical questions on the forum - not to me by personal message. Thanks a lot.

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

I have the code for the analogWrite, but that is of no use at all.
The seperate digitalWrite is given below as
Code:
int s=9;
void setup()
{
 
  pinMode(s,OUTPUT);
}



void loop()
{
  turn_left();
  digitalWrite(s, LOW);
}
 
void turn_left()
{
  digitalWrite(s,HIGH);
  digitalWrite(s,LOW);
  digitalWrite(s,HIGH);
}
the other codes which i actually think might work, are yet to be figured out!
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

Your problem is not that you are taking too long to send that bit stream but you are sending it too quickly. The transmit module will only be able to cope with slowly changing signals because the transmitter does not have the bandwith for fast ones.

Anyway you can't just transmit that and expect to be able to sort it out at the other end.

You need something like this:-
http://www.airspayce.com/mikem/arduino/VirtualWire/
Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12717
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The  encoder chip used has this datasheet: http://www.holtek.com/pdf/consumer/2_12ev120.pdf

It looks like the module will transmit continuously, so if you can figure out the cycle
time through the 4 inputs you can ensure you don't change the inputs too quickly.

You'll have to build some sort of protocol on top of what the chip provides, its merely
an IR remote encoder/decoder pair with 4 input channels.  Think of it as 4 slow
virtual wire connections.

More importantly though theses modules seem not to have the band/frequency
labelled, so cannot legally be operated until you determine what band they use and
whether that band is legal in your territory.  Well I can't see that information in
the eBay link...
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: