idealwhe.blogg.se

How to use robotc
How to use robotc











how to use robotc

#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. Don’t let that word scare you off, I’ve been using it for months now and it’s never failed me. 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. “300 lines of code to read a simple colour?” you ask yourself.įear not, it’s a lot easier than that. You browse through the example programs that are shipped with ROBOTC and open the “ColorSensor.c” program. I just chose turnLeft(), we could have just as easily had used turnRight().So you just bought yourself one of the NXT 2.0 Colour Sensors and you’re keen to get started with it. So let’s start out with a stub to our method: void moveForward ( float inches ) Note: There are lots of synonyms for function, including method and subroutine. The first thing we need to do is get our robot close to the cube, we even said “Move Forward”, so that sounds like a good method to make. So, let’s get started, one small step at a time. HINT: Working in small steps and checking each step as you go is so much easier than trying to do everything all at once. Not only does it make it easier to discuss your Idea with your teammates but it also makes it easier for Judges to understand what you’re trying to do.

how to use robotc

It helps to lay out your steps in short phrases that anyone should be able to understand.

how to use robotc

Move forward (back to goal), some distance.So let’s think about what we need to do just to get the first green block to goal. You should spend some time thinking about what it is you need to do. Programming isn’t about jumping right in and typing. Program the robot to pick up each cube, and place them in the goal. If you look at the Training Table selection screen in Robot Virtual Worlds you’ll see that the description for Basic Movement 1 is:













How to use robotc