ROBOTC.net forumsThe ROBOTC Online Community2018-09-06T11:18:32-04:00http://robotc.net/forums/feed.php?f=12018-09-06T11:18:32-04:002018-09-06T11:18:32-04:00http://robotc.net/forums/viewtopic.php?t=19585&p=44641#p44641startTask(portMonitor); // Make sure there is something in every portAs a 'task', the portMonitor function will run continuously while your main task is running. This is a multi-threaded program. In this task, all ports must be connected to something. If a cable gets accidently un-plugged, the robot will sound an alarm notifying the user that something has been unplugged.

The second function checkPort() allows you to pass a port # and a sensor type as parameters and the robot will check to see if that port has the sensor.

]]>2018-09-04T07:55:49-04:002018-09-04T07:55:49-04:00http://robotc.net/forums/viewtopic.php?t=19585&p=44640#p44640my Team needs to check (before the start of the sumo match), if all the sensor and motor cables are connected.It is possible to do this with RobotC.We use EV3 and NXT.Regards

]]>2018-04-25T08:29:27-04:002018-04-25T08:29:27-04:00http://robotc.net/forums/viewtopic.php?t=19573&p=44637#p44637While this does indicate that the motors are 100% synced. They are synced in opposite directions. The robot will do a "point-turn" in one direction. Using "-100" will turn the robot in the opposite direction.

]]>2018-04-05T11:05:42-04:002018-04-05T11:05:42-04:00http://robotc.net/forums/viewtopic.php?t=19582&p=44633#p44633I have found the online version of the text-based curriculum for RobotC and how to use natural language. The problem we are having is with detecting certain colors. I have four different color pieces of tape on a white table. The students have to have their robot detect which color their robot runs over and then perform a command to move towards the next piece of tape on the table. I am pasting the code we have written:

task main(){clearTimer(T1);while(time1[T1] < 10000) // while the time is less than 10 seconds{if(getColorName(light) == colorWhite) // if the color is white, move forward at 25% power{motor[left] = 25;motor[right] = 25;}

}if ( getColorName(light) == colorYellow) // if the color is yellow, turn right for 270 wheel degrees at 25% power

{turnRight ( 270, degrees, 25) ;}

if ( getColorName(light) == colorBlue) // if the color is blue, turn left for 180 wheel degrees at 25% power

{turnLeft ( 180, degrees, 25) ;}

}

The problem we are having is that the robot will detect the white table and move forward. The program then moves to the second block of code and will detect that color ONLY IF there are no other blocks of code written below it. If we have the third block, where it is detecting some other color, in this case, yellow, the robot will make a right hand turn, instead of left when it sees red. We have changed multiple variables, one at a time, in order to narrow down the problem with no luck. Any ideas? Thanks!

Many of the topics can be taught the same way, but as we progress with our new EV3 robots, I am finding that the old way of writing code doesn't always work and there are new sensors that I have no experience with.