View unanswered posts | View active topics It is currently Wed Oct 01, 2014 8:50 pm






Reply to topic  [ 6 posts ] 
RobotC Curriculum 
Author Message
Rookie

Joined: Wed Jun 18, 2014 4:31 pm
Posts: 10
Post RobotC Curriculum
Just after the first block on the second sentrybot exercise, my ultrasonic sensor starts reading-1. Is it a bug? If it is, how should I fix it?


Mon Jun 23, 2014 3:40 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: RobotC Curriculum
Hello,

Which curriculum are you working on (Lego or VEX), and what specific challenge are you trying to solve? Thanks,


Tue Jun 24, 2014 8:30 am
Profile
Rookie

Joined: Wed Jun 18, 2014 4:31 pm
Posts: 10
Post Re: RobotC Curriculum
Lego, and it is SentryBot 2 over on the sensing tab.
Thank ya.


Tue Jun 24, 2014 3:33 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: RobotC Curriculum
Use the code tags and post your code. I will attempt to replicate what your seeing and give some feedback. Thanks,


Thu Jun 26, 2014 8:26 am
Profile
Rookie

Joined: Wed Jun 18, 2014 4:31 pm
Posts: 10
Post Re: RobotC Curriculum
I know I may sound stupid now, but what is a code tag? Thanks for you patience.


Thu Jun 26, 2014 3:36 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 580
Post Re: RobotC Curriculum
No problem, there is no such thing as a stupid question! The code tag is a tag used on the forums to format text into a 'code' block. You can create a set of code tags by clicking the 'Code' box at the top of the message body field. It will put in a [*code] and [*/code] block (without the asterisks), which is where you'll want to copy your code into. Example:

Normal, non-formatted code:

task main()
{
wait1Msec(2000);
int degrees = 90; // 'degrees' is how many degrees we want to turn

int goal = (SensorValue[compassSensor] + degrees) % 360; // 'goal' is be the current compassSensor reading + our turning degrees
/* We have to use modulus 360 to keep our goal within the bounds */
/* of the compassSensor (1 to 360 degrees, 0 is 360). */

while(SensorValue[compassSensor] != goal) // while the compassSensor sensor reading is not yet our goal:
{
// turn RIGHT in place (point turn):
motor[rightMotor] = -15; // set port2 to speed -15
motor[leftMotor] = 15; // set port3 to speed 15
}
// stop the robot:
motor[rightMotor] = 0; // set port2 to speed 0
motor[leftMotor] = 0; // set port3 to speed 0
}


Code tag formatted code:
Code:
task main()
{
  wait1Msec(2000);
  int degrees = 90;                     // 'degrees' is how many degrees we want to turn

  int goal = (SensorValue[compassSensor] + degrees) % 360;  // 'goal' is be the current compassSensor reading + our turning degrees
                                                      /* We have to use modulus 360 to keep our goal within the bounds   */
                                                      /* of the compassSensor (1 to 360 degrees, 0 is 360).                    */

  while(SensorValue[compassSensor] != goal)   // while the compassSensor sensor reading is not yet our goal:
  {
                              // turn RIGHT in place (point turn):
    motor[rightMotor] = -15;              // set port2 to speed -15
    motor[leftMotor]  = 15;               // set port3 to speed 15
  }
                                        // stop the robot:
  motor[rightMotor] = 0;                // set port2 to speed 0
  motor[leftMotor]  = 0;                // set port3 to speed 0
}

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Thu Jun 26, 2014 3:44 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.