Go Down

Topic: Problems with R/C 6ch transmission (Read 5244 times) previous topic - next topic

Carlos mononoke

here is the model

http://www.hobbyking.com/hobbyking/store/__12901__Hobby_King_2_4Ghz_Receiver_6Ch_V2.html
if you want i can make a picture and sen you

DuaneB

Post the picture here, if we find the right chip, it will be useful for others to follow

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

DuaneB

Ok, it looks like you might have a PPM output on the battery pin.

Write a quick test sketch using pulse in on one of your digital pins and connect the arduino pin to the receiver pin which is nearest the word 'bat'.

If you get a consistent stream of short pulse, you have PPM on that pin.

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

ok here is the photo....

ill try the sketch

DuaneB

This post gets very off topic but seems to suggest that earlier versions of the receiver have PPM on the battery pin (pin nearest bat). Later versions do not.

Yours has ZLH which some people have suggested means it is a later board and does not have PPM, try it anyway, the post is not very clear.

http://9xforums.com/forum/viewtopic.php?f=42&t=1487

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

well.. two things...

first one The Apins works perfectly in the arduino Mega the mistake was that i have selected nano board.... (mmm juyuuu i am discovering how much stupid can i be, no limit for my....)

the second one i have try this sketch:
---------------------------------------------------------------------------------------------------------------------------------------------------
/*
  Prueba de mando R\C
*/
int Ch1Pin =2;

//// variables donde mapeamos la lectura de 0 1024 a 0 256

unsigned long Ch1Var;

//////////////////////////////////////////////////

void setup() {
  Serial.begin(9600);
  pinMode(Ch1Pin,INPUT);

}

void loop() {
  Ch1Var = pulseIn(Ch1Pin,HIGH,200000);   
          Serial.println("POSITIVO");
          Serial.println('Ch1Var,DEC');
  Ch1Var = pulseIn(Ch1Pin,LOW,200000);     
          Serial.println("negativo");
          Serial.println('Ch1Var,DEC');
}
--------------------------------------------------------------------------------------------------------

and what i have obtain in the serial monitor is read 17731 for high and 17731 for low every time like in the beginning of the post....

well and thing taht i had the dremel in one hand and i was screaming CUT the shield nobody know.... jeje i little idiot...

one more time Thanks for your help and time

DuaneB

So no need for plan B - which is a good thing because from your findings it looks like the other link is correct -

boards with ZLH printed on them do not have PPM, older boards found inside the same receiver do have PPM.

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

Well in this days I will try to include RC to the puppet, I´ll tell you how get I on.
XD

Carlos mononoke

Hi,
I have a question again,becouse in am trying to include R/C in a big sketch that I am working.
I have some menus,and only in two option I want to use R/C contol.
So I need to activate and deactivate the interrupt but only this that come from the pins change
becouse I don´t need that the arduino hear all the time to the rc transeiver.

is this possible and how?

Thanks!!!!!!

DuaneB

Hi,
   Two ways to do this

1) Have a mode variable and just ignore the RC Pulses when you don't need them

2) Detach the interrupts using void PCintPort::detachInterrupt(uint8_t arduinoPin)

In and ideal world option 2 would be your best choice, but in Arduino this is not a good choice - it uses the delete function to free the pin memory, this function is not properly supported on Arduino so every time you attach an detach pins a small amount of memory is used up that you sketch cannot use again until it is reset - technically its know as a memory leak.

Option 1 is easy to do and just means that you sketch will be about 1% less efficient.

A third option is to disable individual interrupt flags - but lets not get into that because 1) is easy and has so little impact on your sketch that you will not notice.

so wrap the code in something like this -

Code: [Select]

if(gMode == RC_CONTROL)
{
  read channels
 
  update channels
}


this way the RC Code will only be processed when your sketch sets gMode to RC_CONTROL

Duane B

rcarduino.blogspot.com


Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

So, if i have understand you well, for use mode variable, the gMode is a variable that I must declare before setup or is something that  I can use becouse the library have it.
And when I use if stament I understand that I am allowing to read and copy, but when I am out the flags from rc control will change but the arduino don´t go becouse gMode != RC_CONTROL but Will I need to change gMode to oder value in the code,not? which value/state is this??

DuaneB

You have the idea mostly right.

You mentioned that you have a menu and in two menu options you want RC Control - you could represent each of your menu options as a mode - MODE_MANUAL, MODE_RC_NORMAL, MODE_RC_XXX etc

Then you can have a 'switch case' statement inside loop which does different things depending on the value of gMode -

Code: [Select]

switch(gMode)
{
case MODE_MANUAL:
  // put your manual control code here
break;
case MODE_RC_NORMAL:
  // put your manual control code here
break;
case MODE_RC_XXX:
  // put your manual control code here
break;
}


If you modes are very different, one way that I have done this in the past is to have the code I want for each mode in a separate function -

Code: [Select]
switch(gMode)
{
case MODE_MANUAL:
  doModeManual();
  break;
case MODE_RC_NORMAL:
  doModeRCNormal();
break;
case MODE_RC_XXX:
doModeRCXXX();
break;
// etc etc etc
}


This might also help - http://www.arduino.cc/en/Reference/SwitchCase

Duane B

rcarduino.blogspot.com
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

Yes,i have use switch/case stament for built the menus, and the thing is gMode tath is a variable that i don´t need to define becouse is created by library which values can take( mode_manual,mode_rc,rc_control....)

do you know what I mean?? where can I see the values that i can espect from gMode or i need to define the variable gmode and decide whitch values will contain... and in this case witch kind of variables are this?

DuaneB

Hi,
gMode was just a suggestion, its not in the library ,if you already have a switch/case set up with your modes, add the RC Code to the modes you need it in and leave it out of the others, thats enough to achieve what you want.

Duane B


Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

sorry I am not understanding well, what kind of variable will be gMode(int,boolean...)?
becouse I am understanding that will be one that I can define the spected values (RC_MODE,NO_RC_MODE)

Thanks!!!

Go Up