0% found this document useful (0 votes)
31 views2 pages

Thing 1

The document describes a program that uses a light sensor to detect the brightest light and stores that value in a variable called brightest. When a limit switch is pressed, the brightest value is reset. It includes pseudocode explaining that brightest is initially set to a high value, then updated if the light sensor detects a brighter light while the limit switch is not pressed. When the limit switch is pressed, the program resets brightest to start detecting the brightest light again.

Uploaded by

api-302405982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Thing 1

The document describes a program that uses a light sensor to detect the brightest light and stores that value in a variable called brightest. When a limit switch is pressed, the brightest value is reset. It includes pseudocode explaining that brightest is initially set to a high value, then updated if the light sensor detects a brighter light while the limit switch is not pressed. When the limit switch is pressed, the program resets brightest to start detecting the brightest light again.

Uploaded by

api-302405982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#pragma config(StandardModel, "POE + CIM Testbed")

//*!!Code automatically generated by 'ROBOTC' configuration wizard

!!*//

/*
Project Title:3.1.1+
Team Members: Michael and Rofin
Date: 1/28/16
Section: Block 4
Task Description:
We created a variable called brightest. It will remeber the brightest
light detected by the light sensor. Then when the limitSwitch is hit, the value will be reset.
Pseudocode:
We begin the program in the task main. We then made a global variable called brightest.
Then in the while loop when 1=1, we set the value of brightest to 100000 as the starting
value. We then made another while loop that works when the limit switch has a value of 0.
Then if the sensor value of the lightSensor is less than brightest, brightest takes on the
value of the lightSensor. So brightest remebers the brightest light it senses.
The program is reset when the limitSwitch is pressed.
*/
task main()
{
int brightest;
while (1==1)

//Program begins, insert code within curly braces


// setting brightest as the global variable

{
brightest = 100000;
while (SensorValue(limitSwitch)==0)

//set the value of brightest to 100000


// while the limit switch value = 0

{
if (SensorValue(sonar)<brightest)
{
brightest= SensorValue(sonar);
}
}
}

Section: Block 4

/* if the light sensor value is less than


brightest (when it detects the brightest light)*/
// brightest takes on the value of the light Sensor

Task Description:you press the limit switch and then machine starts if it is pressed agian it stops.

Pseudocode:
Program begins, insert code within curly braces,defined a variable,instantiated a variable,while
the motorCount is less than 20,start left motor slowly
if limit switch is pressed,if limit switch is pressed,stop left motor,start left motor slowly,wait .5
second,stop the left motor,
wait .5 second,add one to the motorCount
*/
task main()
{
int motorCount;
motorCount = 0;
while (motorCount < 20)
{
startMotor(rightMotor, -50);
if(SensorValue(limitSwitch)==1)
{
stopMotor(rightMotor);
startMotor(rightMotor,25);
wait(.5);
//wait .5 second
stopMotor(rightMotor);
wait(.5);
//wait .5 second
motorCount ++;
}
}
}

//Program begins, insert code within curly braces


//defined a variable
//instantiated a variable
//while the motorCount is less than 20
//start right motor slowly
//if limit switch is pressed
//stop right motor
//start right motor slowly

//stop the right motor

//add one to the motorCount

You might also like