Arduino Uno and RF 315MHz wireless interface

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Arduino Uno and RF 315MHz wireless interface

Postby glenise » Thu May 22, 2014 12:42 pm

Hi everyone, i am encountering a problem of using the RF 315MHz wireless module for the arduino Uno.
I am running a small project to control servo motor by using joystick through RF 315MHz wireless.
In my coding, i am using VirtualWire.h library, but the wireless coding part did not work at all.
I am printing the joystick position at the serial monitor but no data shown whenever the wireless command exist. I have to uncommand the wireless part (the 3 lines shown below), only then the joystick data will be appear at the serial monitor.
Whats wrong with my coding? ><
Previously i try to ON/OFF 5 leds with the joystick, no prob at all. I mean to turn ON or OFF leds to indicate the quadrant or position of the joystick.

CODE: SELECT_ALL_CODE
//  vw_set_ptt_inverted(true);
//  vw_set_tx_pin(12);
//  vw_setup(2000);




my whole coding is below; the transmitter part only;

CODE: SELECT_ALL_CODE
// tx joystick for servo COM18
#include <VirtualWire.h>
const int poseX = 1;    // L/R
const int poseY = 0;    // U/D
const int led1 = 7;
int servoVal1;
int servoVal2;
int servoValx;
int servoValy;

void setup() {
  Serial.begin(9600);
  Serial.println("Joystick Joystick Joystick Joystick Joystick"); //
 
  pinMode(led1,OUTPUT);
  digitalWrite(led1,HIGH);
  delay(1000);
  digitalWrite(led1,LOW);
  delay(1000);
 
  vw_set_ptt_inverted(true);
  vw_set_tx_pin(12);
  vw_setup(2000);
}

void loop() {
  outputJoystick();
  servoVal1 = analogRead(poseX);
  servoValx = map(servoVal1, 0, 1023, 170, 20);
  servoVal2 = analogRead(poseY);
  servoValy = map(servoVal2, 0, 1023, 170, 20);
  Serial.println (" ");
  delay(250);
}

void outputJoystick() {
  Serial.print (" Pose X: ");
  Serial.println (servoValx, DEC);
  Serial.print (" Pose Y: ");
  Serial.println (servoValy, DEC);
}
////
glenise
Freshie
 
Posts: 4
Joined: Thu May 22, 2014 12:15 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby sich » Mon May 26, 2014 5:04 pm

glenise WROTE:...I have to uncommand the wireless part (the 3 lines shown below), only then the joystick data will be appear at the serial monitor.

Do you mean "I have to comment the wireless part..."?

Anyway, I don't see any problem with your code. It should display the analog readings in serial monitor no matter you comment/uncomment the 3 lines related to VirtualWire library.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby glenise » Thu May 29, 2014 10:33 am

hmmm..i mean i have to uncomment the 3 lines i've mentioned, then i have my data on the serial monitor.
If that 3 lines of code are in, i dont get anything printed on serial monitor.
That's why i dont know whats the problem...... :(
glenise
Freshie
 
Posts: 4
Joined: Thu May 22, 2014 12:15 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby kl84 » Thu May 29, 2014 2:19 pm

Hey, I've tested ur code with my Arduino uno and it works either way. Both display the analog values in serial monitor correctly.
User avatar
kl84
Amateur
 
Posts: 166
Joined: Thu Jul 08, 2010 12:14 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby glenise » Fri May 30, 2014 10:15 am

Hmm, can figure out what possibly could be my problem if i cant get any data printed on the serial?? The same code use, Arduino Uno board programmed on ver1.0.5 using Windows. :(
glenise
Freshie
 
Posts: 4
Joined: Thu May 22, 2014 12:15 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby ober » Fri May 30, 2014 3:43 pm

How is the wiring/interface of whole system look like?
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby glenise » Tue Jun 03, 2014 1:17 pm

Hey, sorry for the late reply. Now my system works, but i am using the 433 MHz RF module instead of the 315 MHz. Servos work ok, but experience a serious delay...... ><
Maybe my 315 MHz module down.... :mrgreen:
glenise
Freshie
 
Posts: 4
Joined: Thu May 22, 2014 12:15 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby sjwee3 » Thu Jun 12, 2014 4:26 pm

[][/img]
sjwee3
Greenhorn
 
Posts: 2
Joined: Thu Jun 12, 2014 3:22 pm

Re: Arduino Uno and RF 315MHz wireless interface

Postby yonghui » Sun Jun 15, 2014 4:35 pm

U can try slow down the baud rate for 315mhz to 2400bps to try. Low cost rf can operate reliably at higher baud rate



Sent from my T100TA using Tapatalk
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 9 guests

cron