Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pinguino and RF Modules
23-06-2013, 07:51 PM,
#1
Pinguino and RF Modules
Hello, I have bought those RF modules to connect two Pinguinos by RF. There are simple connected (Vcc, GND and DATA), but program doesn't run. I use TX and RX pines of serial library; 8 and 9 in Pinguino 18F25550 and programs are:

Tx:
void setup() {
Serial.begin(2400);
}

void loop() {
Serial.print("A");
delay(2000);
Serial.print("B");
delay(2000);
}

Rx:
void setup()
{
pinMode(7,OUTPUT); // Led on pin 7
Serial.begin(2400); //
}

void loop()
{
if (Serial.available())
{
if (Serial.read()=='A') digitalWrite(7,LOW);
if (Serial.read()=='B') digitalWrite(7,HIGH);
}
}

If I use Pinguino X3, Led keeps LOW and If I use Beta 9.01 Leds is LOW for a little time then HIGH and so on but meaningless.

Could anyone help me?
Reply
23-06-2013, 09:40 PM,
#2
RE: Pinguino and RF Modules
Hello
(23-06-2013, 07:51 PM)Pelelalo Wrote: Hello, I have bought those RF modules to connect two Pinguinos by RF. There are simple connected (Vcc, GND and DATA), but program doesn't run. I use TX and RX pines of serial library; 8 and 9 in Pinguino 18F25550 [...]

it seems to be not so easy...
I've found a post on the arduino forum, the user bld used a library named VirtualWire with a RF module from Seeedstudio. At their wiki there is a PDF describing the the functions of the VirtualWire library. In chapter 2.0 of the document he writes, why not using UART...

Oliver
Reply
24-06-2013, 06:55 AM, (This post was last modified: 24-06-2013, 06:57 AM by moreno.)
#3
RE: Pinguino and RF Modules
Hi

I can see a BUG in this code:
Code:
if (Serial.read()=='A') digitalWrite(7,LOW);
if (Serial.read()=='B') digitalWrite(7,HIGH);
Serial.read empty the FIFO and the second line can't read nothing.

Better solution is:
Code:
char Data;
Data = Serial.read();
switch (Data)
{
  case 'A':
   digitalWrite(7,LOW);
   break;
  case 'B':
   digitalWrite(7,HIGHT);
   break;
}


Bye Bye, Moreno
Reply
24-06-2013, 12:57 PM, (This post was last modified: 24-06-2013, 12:58 PM by Pelelalo.)
#4
RE: Pinguino and RF Modules
(23-06-2013, 09:40 PM)pinguPlus Wrote: Hello
(23-06-2013, 07:51 PM)Pelelalo Wrote: Hello, I have bought those RF modules to connect two Pinguinos by RF. There are simple connected (Vcc, GND and DATA), but program doesn't run. I use TX and RX pines of serial library; 8 and 9 in Pinguino 18F25550 [...]

it seems to be not so easy...
I've found a post on the arduino forum, the user bld used a library named VirtualWire with a RF module from Seeedstudio. At their wiki there is a PDF describing the the functions of the VirtualWire library. In chapter 2.0 of the document he writes, why not using UART...

Oliver

I've seen that library. It seems to work so good. If I cannot make UART works fine, I will try to port this library to Pinguino.

Thanks Oliver.

(24-06-2013, 06:55 AM)moreno Wrote: Hi

I can see a BUG in this code:
Code:
if (Serial.read()=='A') digitalWrite(7,LOW);
if (Serial.read()=='B') digitalWrite(7,HIGH);
Serial.read empty the FIFO and the second line can't read nothing.

Better solution is:
Code:
char Data;
Data = Serial.read();
switch (Data)
{
  case 'A':
   digitalWrite(7,LOW);
   break;
  case 'B':
   digitalWrite(7,HIGHT);
   break;
}


Bye Bye, Moreno

OK. I will try this solution when I arrived at home.

Thanks Moreno.
Reply
25-06-2013, 09:13 AM,
#5
RE: Pinguino and RF Modules
(24-06-2013, 06:55 AM)moreno Wrote: Hi

I can see a BUG in this code:
Code:
if (Serial.read()=='A') digitalWrite(7,LOW);
if (Serial.read()=='B') digitalWrite(7,HIGH);
Serial.read empty the FIFO and the second line can't read nothing.

Better solution is:
Code:
char Data;
Data = Serial.read();
switch (Data)
{
  case 'A':
   digitalWrite(7,LOW);
   break;
  case 'B':
   digitalWrite(7,HIGHT);
   break;
}


Bye Bye, Moreno

OK. I will try this solution when I arrived at home.

Thanks Moreno.
[/quote]

Bug corrected but program still fails. It doesn't work.
Reply
25-06-2013, 04:10 PM,
#6
RE: Pinguino and RF Modules
I've bought such modules this week-end, I hope you can make them work before I receive mine Wink.
Good luck !
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
25-06-2013, 07:08 PM,
#7
RE: Pinguino and RF Modules
(25-06-2013, 04:10 PM)regis Wrote: I've bought such modules this week-end, I hope you can make them work before I receive mine Wink.
Good luck !

This one has made them work. I don't know how:
Reply
25-06-2013, 08:25 PM,
#8
RE: Pinguino and RF Modules
I think the best would be to adapt the VirtualWire library because it uses ASK modulation which provides better communication but you should be able to check if your modules work with simple Serial communication at low speed. I think that's what Yeison did.
BTW, I found these links useful :
http://en.wikipedia.org/wiki/On-off_keying
http://en.wikipedia.org/wiki/Amplitude-shift_keying
http://www.seeedstudio.com/wiki/Grove_-_...F_Link_Kit


(25-06-2013, 07:08 PM)Pelelalo Wrote:
(25-06-2013, 04:10 PM)regis Wrote: I've bought such modules this week-end, I hope you can make them work before I receive mine Wink.
Good luck !

This one has made them work. I don't know how:
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
25-06-2013, 10:30 PM,
#9
RE: Pinguino and RF Modules
(25-06-2013, 08:25 PM)regis Wrote: I think the best would be to adapt the VirtualWire library because it uses ASK modulation which provides better communication but you should be able to check if your modules work with simple Serial communication at low speed. I think that's what Yeison did.
BTW, I found these links useful :
http://en.wikipedia.org/wiki/On-off_keying
http://en.wikipedia.org/wiki/Amplitude-shift_keying
http://www.seeedstudio.com/wiki/Grove_-_...F_Link_Kit


(25-06-2013, 07:08 PM)Pelelalo Wrote:
(25-06-2013, 04:10 PM)regis Wrote: I've bought such modules this week-end, I hope you can make them work before I receive mine Wink.
Good luck !

This one has made them work. I don't know how:

Understood. VirtualWire is, as you say, the best choice. It doesn't use serial links as they describe in its documentation. But, I would like to check these modules with this simple program as Yeison did. And I have probed slow rates for that.

I will see VirtualWire library and on the other hand I would try serial links with RS232 port, just to check.

I hope I could give you some results as soon as possible.
Best Regards
Pablo.
Reply
01-09-2013, 09:48 PM,
#10
RE: Pinguino and RF Modules
hi friends, anyone know if the virtual wire library was adapted to penguin?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)