Hi,my 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

Tue Sep 04, 2018 7:55 am

jkandra

Rookie

Joined: Thu Sep 25, 2014 8:34 pmPosts: 26

Re: Check if a sensor or motor is connected

Here are two functions. The first is a 'task' which can be started in your main Task using the following:startTask(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.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum