Problems with R/C 6ch transmission

ok here is the photo....

ill try the sketch

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.

Duane B

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

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

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

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!!!!!!

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 -

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

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??

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 -

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 -

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

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?

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

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!!!

Hi,
Can you PM me your sketch so that I can make a suggestion based your current structure ?

Duane B

Good morning,
the sketch have 49 pages of code,i was looking in github and google proyect for upload there but it was a little dificult for me( i supposo that it will be easy like a dropbox or something like this....)
if you sendme one email to alehop@mononokeproducciones.com I´ll send you the .pde code.
i am using in this code:

1 arduino Mega 2560
1 4x3 matrix keypad
1 lcd
1 sd21 servo controller
3 thumb joystick (6 potentiometers)
8 buttoms
1 udrive microSDcard (2gb uSD card)
1 RGB led

and now I am changuin to only 1 thumb joystick and 5 buttoms and 6 chanels r/c control.

the structure is:

one menu with 3 posibilities:

PLAY
REC
Config

and inside of this posibilities you have more posibilioties:

Play:

play from memory,
play from the joysticks
and now i want to add here another posibility from RC

Record:

record move (here I need to add the rc control too)
record a secuence of pre recorder movement
erase movement
erase secuence

config:
Format sd card
calibrate joystick

I explain all this becouse went I send you the code you will see that is uncoment, only have comment for me and in spanish...
When I finnish I want to document it in a blog but now... is a little unreadable... sorry

For this reason I only need that arduino hear the RC control in two moments.what i am thinkin is the gMode variable for me only have two posibilities so it is a boolean variable,but how can i create one tath have more posibilities(Manual,RC1,RC",RC)

thanks for your interest!!!!!

Hi,
This weekend I was studying the diference between a class,a structure,and another posibility that is only define a int variable(gMode), and define no_RC =0;RC1=1;RC2=2.....;
and I could use Mode names.
But the thing is allways the calc rutine will be stopping for do the micro second pulse count independently if this is needed or not, so I would try to implement all together and see what happend if I have problems I should try to use detachInterrupt;and see how many times I can use before arduino´s memory is full,and when this happend make a reset.

A better approach is to disable the interrupts at a hardware level.

I have been busy getting two blog posts and videos out this weekend but will get to modes and switching the signal source in a day or two.

I will suggest the ability to temporarily enable and disable interrupts on specific pins to the pin change int guys, if they are not keen i will add it as n externala helper class.

Duane B

When you say disable the interrupt at a hardware level, you mean that power off the transmitter no?? only when you are inside of the rc_mode power on.

Duane I want to understand better how to work with class, do you recomend me some thing for read or see??? becouse I was reading the book beguining with processing but i think the classes in arduino are a little bit diferent.

thanks!!!!

Hi, no transistors, the arduino has a set of registers which enable or disable each pin for generating pin change interrupts. If you disable the interrupt at this level you can leave interrupts attached and disable specific pins until you need them. You can then enable/disable as often as you want with no overhead when they are not in use and no memory leaks from attach/detach

Im in Ethiopia today so no time to dig out the register names.

Duane B

Hi,

Here is a link to the thread where we have been disussing the problem with using detach in pinchangeint. As you can see greygnome has confirmed the issue and is planning to add support for the enable/disable mechanism i suggested as a fix.

http://arduino.cc/forum/index.php/topic,87195.0.html

Duane B

rcarduino.blogspot.com