Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Robosavvy pushing new features onto Robobuilder Kits

Korean company maker of Robot kits and servos designed for of articulated robots. Re-incarnation of Megarobotics.
57 postsPage 2 of 41, 2, 3, 4
57 postsPage 2 of 41, 2, 3, 4

Post by l3v3rz » Mon Oct 19, 2009 8:28 pm

Post by l3v3rz
Mon Oct 19, 2009 8:28 pm

I think we're on a similar wavelength - here's what I have

Image

I use the built in serialport class - equivalent to your RobobuilderCOM.

I then have PCremote (equivalent of Remocon) which has RBC remote functions (although I've not done Playmotion - but it would use the command1B/nb) functions to implement.

Then there is the wckMotion class for the direct servo control.

The reason for the hierarchy is that the switch between modes needs to be controlled by one of the classes so that it knows which mode you're in, and I use PCremote class to do that with a state of DCmode on or off.

So other than the names very similar in approach I think - you know what they say: 'great minds think a like' :)

what do you think ?
I think we're on a similar wavelength - here's what I have

Image

I use the built in serialport class - equivalent to your RobobuilderCOM.

I then have PCremote (equivalent of Remocon) which has RBC remote functions (although I've not done Playmotion - but it would use the command1B/nb) functions to implement.

Then there is the wckMotion class for the direct servo control.

The reason for the hierarchy is that the switch between modes needs to be controlled by one of the classes so that it knows which mode you're in, and I use PCremote class to do that with a state of DCmode on or off.

So other than the names very similar in approach I think - you know what they say: 'great minds think a like' :)

what do you think ?
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by PedroR » Fri Oct 23, 2009 5:22 pm

Post by PedroR
Fri Oct 23, 2009 5:22 pm

Hi l3v3rz

Sorry for the late reply. Robosavvy matters have been taking up a lot of time....

Your approach is indeed very similar.

I see you have already implemented most of the RBC functions (read distance, acceleration and all the other advanced functions).

Maybe we can merge our work. I see you have the RBC class in place, as well a PC function to play Motions, and I have the wCK class done as well.
The wCK class I wrote is in VB6 so maybe its better to rewrite from scratch but it should be quite straightforward.
I remember that at the time it took me some time to realise the functions to read the A/D ports on the servos as well as understand a few specific functions like the LOAD feedback (which in the end is not very well implemented....)


I have only a couple of questions:
- When you use Microsoft.Port.IO, can you access it from any of the other classes?
Doesn't a class get to "own" the IO port?

- Your approach to a class hierarchy is actually smarter now that I think about it.
In fact you offer the services from a higher level to a lower level so it makes sense that you have one class and go deep inside it (to access wckMotion) to go from Higher Level (PCRemote) to lower level (wckMotion)

I am very sorry to say I am tight on my time but I will post my code for the wCK class so that you can have a look at it.

I think we could base our work on your classes because they are very good and just add the whole wCK protocol class.

I can only think of a few things missing there:
- Implement the commands to read the Sound Sensor. I know the way Robobuilder designed it is not very smart because it floods the comm port but maybe we could do something like
ReadSound(threshold, waitMilisecs).
This would be listening to the protocol for the desired Milisecs to see if a loud sound appears.

- Implement the commands to Read the Remocon.
I believe the approach is the same as the sound, right?
Again, maybe we could have it do something like "ReadIRRemote(waitMilisecs)"

- Implement the Command to Play a Sound and the command to play a Motion stored in memory and an Action stored in memory.

What are your thoughts?

Pedro.
Hi l3v3rz

Sorry for the late reply. Robosavvy matters have been taking up a lot of time....

Your approach is indeed very similar.

I see you have already implemented most of the RBC functions (read distance, acceleration and all the other advanced functions).

Maybe we can merge our work. I see you have the RBC class in place, as well a PC function to play Motions, and I have the wCK class done as well.
The wCK class I wrote is in VB6 so maybe its better to rewrite from scratch but it should be quite straightforward.
I remember that at the time it took me some time to realise the functions to read the A/D ports on the servos as well as understand a few specific functions like the LOAD feedback (which in the end is not very well implemented....)


I have only a couple of questions:
- When you use Microsoft.Port.IO, can you access it from any of the other classes?
Doesn't a class get to "own" the IO port?

- Your approach to a class hierarchy is actually smarter now that I think about it.
In fact you offer the services from a higher level to a lower level so it makes sense that you have one class and go deep inside it (to access wckMotion) to go from Higher Level (PCRemote) to lower level (wckMotion)

I am very sorry to say I am tight on my time but I will post my code for the wCK class so that you can have a look at it.

I think we could base our work on your classes because they are very good and just add the whole wCK protocol class.

I can only think of a few things missing there:
- Implement the commands to read the Sound Sensor. I know the way Robobuilder designed it is not very smart because it floods the comm port but maybe we could do something like
ReadSound(threshold, waitMilisecs).
This would be listening to the protocol for the desired Milisecs to see if a loud sound appears.

- Implement the commands to Read the Remocon.
I believe the approach is the same as the sound, right?
Again, maybe we could have it do something like "ReadIRRemote(waitMilisecs)"

- Implement the Command to Play a Sound and the command to play a Motion stored in memory and an Action stored in memory.

What are your thoughts?

Pedro.
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by PeterKesel » Sat Oct 24, 2009 5:48 am

Post by PeterKesel
Sat Oct 24, 2009 5:48 am

Thanks for this post.I see you have already implemented most of the RBC functions.Good reviews.
HID Kit
Thanks for this post.I see you have already implemented most of the RBC functions.Good reviews.
HID Kit
PeterKesel
Newbie
Newbie
Posts: 5
Joined: Sat Oct 24, 2009 5:07 am

Post by l3v3rz » Mon Oct 26, 2009 12:11 pm

Post by l3v3rz
Mon Oct 26, 2009 12:11 pm

Hi,

The Serialport class is locked to a specific port when you open() and freed by the close(). This means that only that class can then read and write is the one that opened it.

I've now added a bunch of extra features to the PCRemote class
Code: Select all
   
       int runMotion(int motion)
       int runSound(int sound)
       int executionStatus(int motion)
       int readIR(int timeout, callback fn)
       int readButton(int timeout, callback fn)
       int readSoundLevel(int timeout, int level, callback fn)


I have hit a problem with readIR - it doesn't seem to ever respond. The code is near identical to readButton that works perfectly.

I have also loaded the new firmware (2.26 has just been release on RoboBuilder site). And that made no difference.

The readSoundLevel returns data although the sound level seems very low, (i.e. never above '1'). So there may be some kinks to work out.

Have you got the IR working in your library, if so it would be great to see the code. I had a look at the sample C code supplied (forum link) - and interestingly although it support reading button and reading sound level there is no support for read IR (command 25) - co-incidence ?

regards

l3v3rz
Hi,

The Serialport class is locked to a specific port when you open() and freed by the close(). This means that only that class can then read and write is the one that opened it.

I've now added a bunch of extra features to the PCRemote class
Code: Select all
   
       int runMotion(int motion)
       int runSound(int sound)
       int executionStatus(int motion)
       int readIR(int timeout, callback fn)
       int readButton(int timeout, callback fn)
       int readSoundLevel(int timeout, int level, callback fn)


I have hit a problem with readIR - it doesn't seem to ever respond. The code is near identical to readButton that works perfectly.

I have also loaded the new firmware (2.26 has just been release on RoboBuilder site). And that made no difference.

The readSoundLevel returns data although the sound level seems very low, (i.e. never above '1'). So there may be some kinks to work out.

Have you got the IR working in your library, if so it would be great to see the code. I had a look at the sample C code supplied (forum link) - and interestingly although it support reading button and reading sound level there is no support for read IR (command 25) - co-incidence ?

regards

l3v3rz
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by PedroR » Tue Oct 27, 2009 2:35 pm

Post by PedroR
Tue Oct 27, 2009 2:35 pm

Hi l3v3rz

I must congratulate you on your great work!

With regards to ReadIR I would not be surprised if it is not implemented.
If the sample firmware is not showing it and you're not seeing anything then it's most likely not working for now.

I know Robobuilder is using and improving specific command sthat they need to use with their full implementation of MSRDS.
These would include reading all the sensors but not necessarilly the IR so it's probably a feature not yet implemented.


On Friday I ended up not posting my code, but I have now uploaded it.
It is available here: http://robosavvy.com/RoboSavvyPages/Rob ... twarePedro

The RAR file is 8Mb and it packs everything I have developed (and semi-developped) so far.

The most interesting bit of code is under the folder "Wrapper Classes".
There you can find the implementation of the wCK protocol as well as a test program.
You need to open "Group1.vgb" under "Wrapper classes". If you get an error of "ActiveX can't create component", open Project->References and just tick "RobobuilderLibrary".
This is a VB6 project and please note the code has a built in delay of 200ms in many places. That's a nasty hack I used at the time because I getting some errors where the computer was reading the COMM port without having received the data yet and that was generating errors.

Also, have you got your code up in Google Code or something like that?
You seem to have hit a stage where your code is now publiclly usable for very nice projects :)

One question, though: some of the calls have a last parameter that looks like a callback. Is that the case?
Hi l3v3rz

I must congratulate you on your great work!

With regards to ReadIR I would not be surprised if it is not implemented.
If the sample firmware is not showing it and you're not seeing anything then it's most likely not working for now.

I know Robobuilder is using and improving specific command sthat they need to use with their full implementation of MSRDS.
These would include reading all the sensors but not necessarilly the IR so it's probably a feature not yet implemented.


On Friday I ended up not posting my code, but I have now uploaded it.
It is available here: http://robosavvy.com/RoboSavvyPages/Rob ... twarePedro

The RAR file is 8Mb and it packs everything I have developed (and semi-developped) so far.

The most interesting bit of code is under the folder "Wrapper Classes".
There you can find the implementation of the wCK protocol as well as a test program.
You need to open "Group1.vgb" under "Wrapper classes". If you get an error of "ActiveX can't create component", open Project->References and just tick "RobobuilderLibrary".
This is a VB6 project and please note the code has a built in delay of 200ms in many places. That's a nasty hack I used at the time because I getting some errors where the computer was reading the COMM port without having received the data yet and that was generating errors.

Also, have you got your code up in Google Code or something like that?
You seem to have hit a stage where your code is now publiclly usable for very nice projects :)

One question, though: some of the calls have a last parameter that looks like a callback. Is that the case?
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by l3v3rz » Tue Oct 27, 2009 3:30 pm

Post by l3v3rz
Tue Oct 27, 2009 3:30 pm

Hi,

The codes all in a google project - http://code.google.com/p/robobuildervc/

If you message me your google mail ID - I can add you into the project
Yes the read button use a call back function -
Code: Select all
       

private void button4_Click(object sender, EventArgs e)
{
       // read Button -
       button4.Enabled = false;
       pcR.readButton(10000, new callBack(addMessage));
       button4.Enabled = true;
}

public void addMessage(int n)
{
       textBox1.AppendText("value received = " + n + "\r\n");
}


So when you click a button on windows - it greys it out and waits for PF1/2 button presses for 10secs. Every press causes addMessage to be called - which displays result on screen.

I've now added most of the low level wcK functions as well (not tested) but you can set IO values, boundaries, torq, speed , gain etc for any servo as well.

I've had a look at the firmware - and can't see the IR code either - its near identical to the C source they supplied as far as I can tell. SO no IR read capability - I wonder which version of firmware its planned for ??

cheers
Hi,

The codes all in a google project - http://code.google.com/p/robobuildervc/

If you message me your google mail ID - I can add you into the project
Yes the read button use a call back function -
Code: Select all
       

private void button4_Click(object sender, EventArgs e)
{
       // read Button -
       button4.Enabled = false;
       pcR.readButton(10000, new callBack(addMessage));
       button4.Enabled = true;
}

public void addMessage(int n)
{
       textBox1.AppendText("value received = " + n + "\r\n");
}


So when you click a button on windows - it greys it out and waits for PF1/2 button presses for 10secs. Every press causes addMessage to be called - which displays result on screen.

I've now added most of the low level wcK functions as well (not tested) but you can set IO values, boundaries, torq, speed , gain etc for any servo as well.

I've had a look at the firmware - and can't see the IR code either - its near identical to the C source they supplied as far as I can tell. SO no IR read capability - I wonder which version of firmware its planned for ??

cheers
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by PedroR » Fri Nov 06, 2009 12:20 pm

Post by PedroR
Fri Nov 06, 2009 12:20 pm

Hi l3v3rz

I keep apologising for the delay in replying..... in fact there is a lot going on at Robosavvy in preparation for Christmas and I have been unable to keep up with this thread.

My google id is pedro.ramilo@gmail.com and it would be great if you could add me to the project.

I have noticed you have changed the google project page to reflect all these new features and it looks really nice :)

One other thing I wanted to let you know is that I have added your project to the Robobuilder product page.
In fact I have revised the whole page for the Christmas promotion (the one with Distance Sensor + Acc Sensor already in - no voice though).

I was very pleased to find out that during the last year and a half a lot fo projects and options surfaced for Robobuilder. There are now 5 programming options available and, to be honest, my favourite one would be your library.
In any case it offers a very smooth learning curve: ActionBuilder -> MSRDS -> Your project/libraries -> C programming on the ATMEGA

Please let me know if I have referenced the correct people / contributors for your library. I was under the impression the work is by you and phil, right?

Let me know if I should make any correction.

Thank you very much for all your contribution.

Pedro.
Hi l3v3rz

I keep apologising for the delay in replying..... in fact there is a lot going on at Robosavvy in preparation for Christmas and I have been unable to keep up with this thread.

My google id is pedro.ramilo@gmail.com and it would be great if you could add me to the project.

I have noticed you have changed the google project page to reflect all these new features and it looks really nice :)

One other thing I wanted to let you know is that I have added your project to the Robobuilder product page.
In fact I have revised the whole page for the Christmas promotion (the one with Distance Sensor + Acc Sensor already in - no voice though).

I was very pleased to find out that during the last year and a half a lot fo projects and options surfaced for Robobuilder. There are now 5 programming options available and, to be honest, my favourite one would be your library.
In any case it offers a very smooth learning curve: ActionBuilder -> MSRDS -> Your project/libraries -> C programming on the ATMEGA

Please let me know if I have referenced the correct people / contributors for your library. I was under the impression the work is by you and phil, right?

Let me know if I should make any correction.

Thank you very much for all your contribution.

Pedro.
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by l3v3rz » Fri Nov 06, 2009 5:04 pm

Post by l3v3rz
Fri Nov 06, 2009 5:04 pm

Pedro - you are now added as contributor - let me know if you have any problems - the VB6 stuff would be really good if you want to play with that to make better. (i.e. please feel free to edit - I assume you know how to use svn etc ?)

cheers
Pedro - you are now added as contributor - let me know if you have any problems - the VB6 stuff would be really good if you want to play with that to make better. (i.e. please feel free to edit - I assume you know how to use svn etc ?)

cheers
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by PedroR » Tue Nov 10, 2009 7:20 pm

Post by PedroR
Tue Nov 10, 2009 7:20 pm

Hi

The new RBCs with the Acc Sensor and Voice Output are now in store here: http://robosavvy.com/store/product_info ... cts_id/590

Also, int he last months new programming options and libraries have surfaced for Robobuilder and I believe it is now one of the Robots we have with the higher number of programming options.

I have compiled all the documentation and information about the protocols and programming options in the main product page for the 5710K here http://robosavvy.com/store/product_info ... cts_id/445

Just scroll down to the "Documentation" section.

FYI I have also added a link to the grippers by l3v3rz for Robobuilder.
I think there are now 3 new gripper options as well.

Regards
Pedro.
Hi

The new RBCs with the Acc Sensor and Voice Output are now in store here: http://robosavvy.com/store/product_info ... cts_id/590

Also, int he last months new programming options and libraries have surfaced for Robobuilder and I believe it is now one of the Robots we have with the higher number of programming options.

I have compiled all the documentation and information about the protocols and programming options in the main product page for the 5710K here http://robosavvy.com/store/product_info ... cts_id/445

Just scroll down to the "Documentation" section.

FYI I have also added a link to the grippers by l3v3rz for Robobuilder.
I think there are now 3 new gripper options as well.

Regards
Pedro.
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

I have problem with runing motion

Post by mniki » Thu Mar 11, 2010 11:18 am

Post by mniki
Thu Mar 11, 2010 11:18 am

Hi, ThaNks for your usefull and nice topic.
i use PCremote class to read the serial number and i can read it successfully, but when i want to run a motion with PCremote class, it doesn't work and my program getting hang.
i place runmotion method exactly instead of readSN method, but it didn't work. Please Heeelp meEee!
i write my program in VS2008 using C# language.
Hi, ThaNks for your usefull and nice topic.
i use PCremote class to read the serial number and i can read it successfully, but when i want to run a motion with PCremote class, it doesn't work and my program getting hang.
i place runmotion method exactly instead of readSN method, but it didn't work. Please Heeelp meEee!
i write my program in VS2008 using C# language.
mniki
Robot Builder
Robot Builder
Posts: 12
Joined: Thu Mar 11, 2010 11:13 am

Post by l3v3rz » Thu Mar 11, 2010 6:09 pm

Post by l3v3rz
Thu Mar 11, 2010 6:09 pm

Hi -

It should work, can you post the extract of your code where you call runMotion ?

Also check you have the latest version of the dll http://robobuildervc.googlecode.com/fil ... derLib.dll

and also check your firmware version is 2.23 or better

cheers
Hi -

It should work, can you post the extract of your code where you call runMotion ?

Also check you have the latest version of the dll http://robobuildervc.googlecode.com/fil ... derLib.dll

and also check your firmware version is 2.23 or better

cheers
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by AlexanderHWUK » Thu Mar 11, 2010 11:22 pm

Post by AlexanderHWUK
Thu Mar 11, 2010 11:22 pm

Wow! I had completely missed this incredibly useful thread about C# Coding!

I haven't had much time lately to code, and I've been mainly researching about how to transmit through a Com port, open/close Coms, detect Robobuilder, etc. using C#.

Will this code/library allow me to communicate with the Robobuilder through the COM port, and make it easy for me to send commands and queries using the RBC protocol?

I have decided to retain the original firmware of the Robobuilder, as this will simplify things for me now. The only things I want to achieve for now is to send some commands to the robobuilder, and receive some data, like PSD values.

Keep up the good work,

Alex
Wow! I had completely missed this incredibly useful thread about C# Coding!

I haven't had much time lately to code, and I've been mainly researching about how to transmit through a Com port, open/close Coms, detect Robobuilder, etc. using C#.

Will this code/library allow me to communicate with the Robobuilder through the COM port, and make it easy for me to send commands and queries using the RBC protocol?

I have decided to retain the original firmware of the Robobuilder, as this will simplify things for me now. The only things I want to achieve for now is to send some commands to the robobuilder, and receive some data, like PSD values.

Keep up the good work,

Alex
AlexanderHWUK
Savvy Roboteer
Savvy Roboteer
Posts: 27
Joined: Tue Mar 02, 2010 4:54 pm

Post by l3v3rz » Fri Mar 12, 2010 1:07 am

Post by l3v3rz
Fri Mar 12, 2010 1:07 am

Yes - with C# its very easy to do what you need. The code looks something like this (call with pn would be set to name of COM port):

Code: Select all
     
using System;
using System.IO;
using System.IO.Ports;   
using RobobuilderLib;

public int connect(string pn)
        {
            string serialNumber = "";

            try
            {
                SerialPort p = new SerialPort(pn, 115200, Parity.None, 8, StopBits.One);

                p.ReadTimeout = 1000;
                p.WriteTimeout = 1000;


                PCremote pcr = new PCremote(p);

                p.Open();

                serialNumber = pcr.readSN();

                p.Close();

                return 1;
            }
            catch (Exception e1)
            {
                return 0;
            }
        }




See top of thread for more info on the class.

But for example to read the PSD should be:

string res = pcr.readDistance();

or read accelerometer:

int[] result = pcr.readXYZ();

Or to run a motion (in this case basic pose) put:

pcr.runMotion(7);

If you come across problems please let me know and I shall try and fix

regards
Yes - with C# its very easy to do what you need. The code looks something like this (call with pn would be set to name of COM port):

Code: Select all
     
using System;
using System.IO;
using System.IO.Ports;   
using RobobuilderLib;

public int connect(string pn)
        {
            string serialNumber = "";

            try
            {
                SerialPort p = new SerialPort(pn, 115200, Parity.None, 8, StopBits.One);

                p.ReadTimeout = 1000;
                p.WriteTimeout = 1000;


                PCremote pcr = new PCremote(p);

                p.Open();

                serialNumber = pcr.readSN();

                p.Close();

                return 1;
            }
            catch (Exception e1)
            {
                return 0;
            }
        }




See top of thread for more info on the class.

But for example to read the PSD should be:

string res = pcr.readDistance();

or read accelerometer:

int[] result = pcr.readXYZ();

Or to run a motion (in this case basic pose) put:

pcr.runMotion(7);

If you come across problems please let me know and I shall try and fix

regards
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

I can run the motion now!

Post by mniki » Fri Mar 12, 2010 8:22 am

Post by mniki
Fri Mar 12, 2010 8:22 am

Thank so much for your reply! i founf my misstake in your post and your example. I should start motions with motion number 7 :D, but it try to start it with motion 4 which is forward walking motion. all my mistake was that. i wanna to design and implement a board to controll RBC with another AVR micorcontroller!
Thank so much for your reply! i founf my misstake in your post and your example. I should start motions with motion number 7 :D, but it try to start it with motion 4 which is forward walking motion. all my mistake was that. i wanna to design and implement a board to controll RBC with another AVR micorcontroller!
mniki
Robot Builder
Robot Builder
Posts: 12
Joined: Thu Mar 11, 2010 11:13 am

Problem with runing motion again!

Post by mniki » Fri Mar 12, 2010 1:35 pm

Post by mniki
Fri Mar 12, 2010 1:35 pm

i try to controll RBC via a mega 8 AVR microcontroller, i write two simple function. These functions works for reading serial Number command and has no error but when i want to use them for runing motion command, RBC error LED (Red LED) stat blinking.
functions are:

//****************************************
unsigned char rls_data[6] = { 0xFF, 0xE0, 0xFB, 0x01, 0x00, 0x1A };
unsigned char header[8] = { 0xFF, 0xFF, 0xAA, 0x55, 0xAA, 0x55, 0x37, 0xBA };

void rls_mode(){

for(i =0 ; i<6 ; i++){
putchar(rls_data[i]);
}
}

void send_cmd(unsigned char type, unsigned char cmd){

//sending header
for (i =0;i<8;i++){
putchar(header[i]);
delay_ms(1);
}
//sending type of command
putchar(type);
// sending platform mode
putchar(0x00);
//sending size of command
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x01);

//sending cmd
putchar(cmd);

//check sum (xor of cmd(s))
putchar(cmd);


}
//*********************************************

in the main function is write like as follow:

rls_mode();
delay_ms(2000);
//send_cmd(20,7);// it gets error and RBC red LED (error LED) start blinking
send_cmd(0x0c,0x01); // it works without any errors
while(1);

help me on this please.
i try to controll RBC via a mega 8 AVR microcontroller, i write two simple function. These functions works for reading serial Number command and has no error but when i want to use them for runing motion command, RBC error LED (Red LED) stat blinking.
functions are:

//****************************************
unsigned char rls_data[6] = { 0xFF, 0xE0, 0xFB, 0x01, 0x00, 0x1A };
unsigned char header[8] = { 0xFF, 0xFF, 0xAA, 0x55, 0xAA, 0x55, 0x37, 0xBA };

void rls_mode(){

for(i =0 ; i<6 ; i++){
putchar(rls_data[i]);
}
}

void send_cmd(unsigned char type, unsigned char cmd){

//sending header
for (i =0;i<8;i++){
putchar(header[i]);
delay_ms(1);
}
//sending type of command
putchar(type);
// sending platform mode
putchar(0x00);
//sending size of command
putchar(0x00);
putchar(0x00);
putchar(0x00);
putchar(0x01);

//sending cmd
putchar(cmd);

//check sum (xor of cmd(s))
putchar(cmd);


}
//*********************************************

in the main function is write like as follow:

rls_mode();
delay_ms(2000);
//send_cmd(20,7);// it gets error and RBC red LED (error LED) start blinking
send_cmd(0x0c,0x01); // it works without any errors
while(1);

help me on this please.
mniki
Robot Builder
Robot Builder
Posts: 12
Joined: Thu Mar 11, 2010 11:13 am

PreviousNext
57 postsPage 2 of 41, 2, 3, 4
57 postsPage 2 of 41, 2, 3, 4