Pinguino Forum

Full Version: Pinguino and RF Modules
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
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
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
(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.
(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.
I've bought such modules this week-end, I hope you can make them work before I receive mine Wink.
Good luck !
(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:
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:
(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.
hi friends, anyone know if the virtual wire library was adapted to penguin?
Pages: 1 2