![robotc commands list cortex 2.0 robotc commands list cortex 2.0](http://www.robotcombat.com/products/images/store_vexexamples_lg.jpg)
*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//Ĭase BLACKCOLOR: sColor = "Black" break Ĭase GREENCOLOR: sColor = "Green" break Ĭase YELLOWCOLOR: sColor = "Yellow" break Ĭase WHITECOLOR: sColor = "White" break Īs you can see, not a whole lot to it. #pragma config(Sensor, S1, colorPort, sensorCOLORFULL) Please note that this is basically a stripped down version of the one shipped with ROBOTC I just removed all of the diagnostics crud that the developers added so they could debug their drivers. Here’s a very simple program that will display the currently detected colour on the screen. The NXT 2.0 Colour Sensor is super easy to use. The default motor operating mode is an open loop configuration. Don’t let that word scare you off, I’ve been using it for months now and it’s never failed me. To move motor ‘A’ forward at 50 of full power, you would use the following statement: motormotorA 50 // set motorA to power level 50 (forward, half speed) motor is the ROBOTC array variable that controls the motor power and motorA is an enum variable for motor A. Don’t worry, though, it’s a very stable beta. In order to use the NXT 2.0 colour sensor you’ll need to make sure of one thing: you absolutely need at least ROBOTC 2.26.1 for NXT, anything less simply won’t work. ROBOTC Natural Language - NXT Quick Reference: © 2010 Carnegie Mellon Robotics Academy / For use with LEGO® MINDSTORMS® Education NXT software and base set 9797. We called Vex, and they made me download my code over the A to A cable. Yes, it is being reconized by the computer. If your Cortex is being recognized by the PC, you will see listed VEX Robotics Comm. “300 lines of code to read a simple colour?” you ask yourself.įear not, it’s a lot easier than that. With your Cortex connected with the USB A-to-A cable to your PC, open Windows Device Manager and look under Ports. You browse through the example programs that are shipped with ROBOTC and open the “ColorSensor.c” program.
![robotc commands list cortex 2.0 robotc commands list cortex 2.0](https://i.ytimg.com/vi/-eyxgYvWYeQ/maxresdefault.jpg)
The sensorName parameter is the port or name of the Line Tracking Sensor that will track the line The threshold parameter is the average value between the sensors 'dark' and 'light' readings. You must manually set the motors and sensors in the Motors and Sensors Setup menu.
![robotc commands list cortex 2.0 robotc commands list cortex 2.0](http://botbench.com/blog/wp-content/uploads/2011/02/ss-2011-02-08_08-16-56.png)
This snippet of code will set the robot type to none by default, skipping the setup process. So you just bought yourself one of the NXT 2.0 Colour Sensors and you’re keen to get started with it. This command makes the robot follow the right edge of a line using the VEX Cortex line follower sensor. 'robotType(none) ' Also please note that this command should be the first thing in your 'task main()'.