|
Explore TEAMS!
|
Student /
RuggPhotophilic/* Add comment - Allison Rugg - Blue Cohort - Braitenberg - Jan 09 - and overview here
// Include the Command Module API
// Pointer to the Sensor Data structure cr8_t *cr8; cr8_adc_enable(ADC_CENTER_1); // Declare any new function prototypes here: // For example: int dashboard(int counter, char partnumber); // Declare GLOBAL constants used in program: // Declare GLOBAL Variables used in program: int light(void); // Initialize GLOBAL Variables used in program: int light = 0; // Declaraion for function "main" int main(void) { cr8 = cr8_alloc(); while(cr8->button_play=0) //wait for play to be pressed {
switch(cr8_stopwatch_time( ) %2)
{
case 0:
{
cr8_set_leds(1,0,100,255);
cr8_drive_direct(0,0);
cr8_update(cr8);
}
case 1:
{
cr8_set_leds(1,0,100,255);
cr8_drive_direct(0,0);
cr8_update(cr8);
}
}
}
cr8_start_stopwatch(); while(cr8_stopwatch_time()<=1200) //set 2 min. time limit {
cr8_update(cr8);
cr8_stopwatch_time();
}
while(!cr8->wheeldrop_right || !cr8->wheeldrop_left || !cr8->wheeldrop_caster)//while safe {
cr8_angle()= 0;
while(cr8_angle()<=359)
{
cr8_drive_direct(0,250);
cr8_update(cr8);
if(cr8->adc_center1 <= light)
{
light=cr8->adc_center1;
}
}
while(cr8->adc_center1>=light && light<=)
{
cr8_drive_direct(250,250);
cr8_update(cr8);
}
}
cr8_free(cr8); return(0); } /* Initialize the Create and Command Module
Sync communications settings. */
// End of function main
/* Declare other functions you create here... For example, to define function xxxxx of type integer (int) with two input parameters, sample_num and code... int xxxxx(int sample_num, char code) { // Declare LOCAL constants used in function xxxxx: // Declare LOCAL Variables used in function xxxxx: // Initialize LOCAL Variables ised in function xxxxx: // Write code for function XXXXX here: //Return int value for function xxxxx: return(1); You must always return a value to sending program --in this case a 1 to indicate fn done with no problems. } // End of function xxxxx
|