!! Got it! I just took out the commend on #define transmitter, took out the recieve and decode for now, and I am getting stuff in the terminal window of the pic. It almost looks like it isn’t correctly decoding it though. I’ll keep looking at it and see if I can notice anything.
This is what it is outputing:
M:0000,0000,0c,00:
A0 0, A1 36765696
- or -
M:03FF,03FF,0C,00:
A0 67044351, A1 36766719
Alright, this printtoscreen line is messing it up, because I printed analog0 and analog1 separately, and they all printed normally.
PrintToScreen ( “A0 %ld, A1 %ld\n”, analog0, analog1 );
Edit, I changed it to PrintToScreen ( “A0 %d, A1 %d\n” , analog0, analog1) ; and it is working great! Can I make the variables globals so I can access them in the drag-and-drop gui?
That was my mistake, in the original code for the arduino, analog0 and analog1 were of type long, I had to change that for the PIC which does not support long but did not change the PrintToScreen statement. Remember, I could not test the EasyC code so it may have other bugs. Sure, make them global if you want.
So how would I do that?
Add them to the globals dialog. Remove the local definitions from the serialRxDecode and then somewhere in the file add them as external variables, perhaps like this.
extern unsigned int analog0;
extern unsigned int analog1;
void
serialRxDecode()
{
char *p;
// Show buffer for DEBUG
PrintToScreen ( "%s\n" , RxBuffer) ;
It works awesome! Thanks! I think I will do this with all variables so that I can access them anywhere in the programs. It will also be easier to make the drive code and everything.
Can you post both your Code Bases?? With EasyC include all the Files…
It is working now
It is actually working perfectly
Do you still want me to post the code?
Quidquid necesse est ![]()
?? Is that english?
If you want to give those that come after you a “leg up”, then please do…
You can place Source Code projects in the Vex Code Area.
Latin, I would Guess… You Try Google Translate?? Or here.
It’s a literal translation of “whatever is necessary”
Making all variables in a program global is generally frowned upon, however, in this case as you are still learning, if that works for you then go for it.
I’ll post the code soon. For a test controller, I am just going to hook up a PS1 controller to my Arduino, and send those to drive Tank. Is there any way I can change the API.h to use my joystick values instead of the other controllers values so that I can just drag in a holonomic drive control and set it to the custom values?
Does EasyC Pro support Holonomic Control as a Drag and Drop?? I can not locate it in in v3.1.3.5
I thought it did, but that must have been EasyC V4 Cortex that I used. Is there any way I can still use it?
Well I finally got the PS1 controller all soldered up and working, but if you have both joysticks forward or backwards, the value is the same, causing one tread to turn opposite of the other one. I forgot how to do it, but how do you invert the value to the motor?
I’ll just map it on the Arduino side for now, but I just wanna do in on the Vex side in the future.
Here is a video connected to my 2 high strength motor tank base I built. Over all, it is awesome and it all works! This is what I plan to do:
-Make my own custom controller to replace the PS1 controller
-Make it wireless with either Wifi or XBee
Oh, and I still need to figure out how to invert or reverse the one joystick value so the tread isn’t going opposite the other tread. I tried timesing it by -1 to figure out that negatives arn’t allowed with motors. For the time being, I used the map function on the Arduino side to reverse the values, but I would rather do it with just math on the Vex side, because who knows, I could want to use the same joystick for something else and I would have to reverse it again on Vex.