cortex joystick buttons and robotc print to screen

hi

I’m working on a project with the new cortex controller and the joystick.

I need to be able to access the individual buttons on the D-pad of the joystick, which I can do with easyC, but I would prefer to use robotC. I can’t work out how the buttons are accessed with robotC (2.20.1 beta). Does anybody know?

Also, I want to print out to an external file, while running a program. This is possible with easyC, using print to screens and the text capture function of the terminal window. However, I do want to use robotC. I know about the debugger (which is excellent btw) but the external file is what I really need, and no amount of searching has produced any answers about how to print to a file. Any ideas?

Thanks in advance
vdsa

use vexRT[Btn??], where ?? is the channel and button letter. The button value is 0 when not pressed, and 1 when pressed.

eg. to make an arm go up and down on channel 7 using the up and down buttons,

if(vexRT[Btn7U] == 1){
motor[arm] = 127;
else if(vexRT[Btn7D] == 1){
motor[arm] = -127;
else{
motor[arm] = 0;
}

I have had the same problem. Unless it has changed recently, I don’t think there is any support for print functions in RobotC.

https://vexforum.com/t/print-functions-in-robotc/16127/1

When I was beta testing the cortex I used the UART to feed information back to the computer. You can use the VEX usb to serial cable, but you will need to convert from TTL to RS232. Then use a serial terminal like Realterm to capture the information to a file.

Although, I don’t think this is a very elegant way of doing it at all. Only did it this way because I had the set up already. There is probably a much easier solution out there.

I have now switched to EasyC after the major bug in RobotC 2.16.

Could you show us how to do the UART feed back at the next scrimmage?

Yea for sure. Will bring one of my projects to the scrimmage this Saturday.

UART is really useful when doing more advanced projects with VEX. eg.

  • Communicating between 2 or more microcontrollers. Good when you need to control more than 8 motors.
  • Communicating with a PC. In a recent project I used a PC to do image processing from a webcam and used UART to tell an old PIC microcontroller to move the robot’s motors.
  • Communicating directly with an embedded camera module ie. CMUCAM
  • Have also used it with non-vex LCD screens.

Although none of these are competition legal. If you are just wanting to capture data to a file, EasyC has this feature built in.