task main()
{
  //Create and configure struct for the compass:
   // Create struct to hold sensor data:
   tHTMC compass;
   // Initialise and configure struct and port:
   initSensor(&compass, S4);

  //Define destination coordinates:
  long destLat = 0;		// Add the latitude destination here.
  long destLong = 0;	// Add the longitude destination here.

  long GPSrelHeading;
  long distance;

  DGPSsetDestination(DGPS, destLat, destLong);

  while (DGPSreadDistToDestination(DGPS) > 0) //Travelling to destination
  		{
        GPSrelHeading = DGPSreadRelHeading(DGPS);
        distance = DGPSreadDistToDestination(DGPS);

  		  // Here, the relative heading of the GPS is set as the target heading of the compass;
        // a compass.relativeHeading of 0 means the destination is straight ahead, > 0 heading means it
        // is to the left, and < 0 means the dest is to the right.
        readSensor(&compass);
        compass.offset = GPSrelHeading;

        displayTextLine(3, "GPSRelHead: %d", GPSrelHeading);
    		readSensor(&compass);
		    displayTextLine(5, "CompRelHead: %d", compass.relativeHeading);
  		  displayTextLine(7, "Distance: %d", distance);

  		  setMotorSpeed(LEFT, 75);
  			setMotorSpeed(RIGHT, 75);

  			readSensor(&compass);
  		  if (compass.relativeHeading > 5) //If car is right of dest., turn left
  			     {
  				     steerLeft();
  			     }
  			     else if (compass.relativeHeading < -5) //If car is left of dest., turn right
  			          {
  			            steerRight();
  			          }
  			          else //dest. is forward
  			          {
  			            steerRecenter();
  			          }
  		  sleep(1000);
  	  }
  		//Destination reached
  		setMotorSpeed(LEFT, 0);
  		setMotorSpeed(RIGHT, 0);
  		steerRecenter();
}
示例#2
0
void ssThread::checkSensor(){
    int res;
    res  = readSensor(PIN_FLAME);
    if (res == 0)
        Flame = true;
    res  = readSensor(PIN_SHAKE);
    if (res == 1)
        Shake =true;
    res  = readSensor(PIN_SMOKE);
    if (res == 1)
        Smoke =true;
}
示例#3
0
int readAllSensors()
{
	for (int i = 0; i < numOfRegToRead; i++)
	{
		readSensor(i);
	}
}
示例#4
0
/**********************************************************
 * GetTemperature
 *  Gets the current temperature from the sensor.
 *
 * @return float - The temperature in Deg C
 **********************************************************/
float SHT2xClass::GetTemperature(void)
{
	float data = readSensor(eTempNoHoldCmd);
	if (isnan(data))
		return NAN;
	return (-46.85 + 175.72 * (data / 65536.0));
}
task main ()
{
  // This struct holds all the sensor related data
  tDIMC compass;
	tSensors DIMC = S1;

  // Our local variables
  short strength = 0;

  // Fire up the compass and initialize it. Only needs to be done once.
  if (!initSensor(&compass, DIMC))
    playSound(soundException);

  // Loop forever, reading the sensor and calulating total
  // field strength
  while (true)
  {
    // Read the Compass
    if (!readSensor(&compass))
      playSound(soundException);

    // calculate the field strength
    strength = sqrt(pow(compass.axes[0], 2) + pow(compass.axes[1], 2) + pow(compass.axes[2], 2));

    // Play a tone of the frequency of the field strength
    // Great for annoying the cat/dog/wife/parent
    playImmediateTone(strength, 8);

    // display on the screen
    displayCenteredBigTextLine(3, "%d", strength);
    sleep(50);
  }
}
示例#6
0
void AC_RotatingPot::poll() {
  int sensor = readSensor();
  if (ignoring != 0) {
    if ((ignoring == +1 && sensor < reference)
     || (ignoring == -1 && sensor > reference)) {
      ignoring = 0;
    }
    reference = sensor;
  }
  if (ignoring == 0) {
    int valueDelta = (sensor - reference) / sensitivity;
    if (inverted) {
      valueDelta = -valueDelta;
    }
    int valueNew = valueOffset + valueDelta;
    if (value != valueNew) {
      value = valueNew;
      if (changeHandler != NULL) {
        changeHandler();
      }
    }
    if (sensor == 0 || sensor == 1023) {
      valueOffset += valueDelta;
      // prevent long-term overflows by taking modulo if needed
      valueOffset = getModuloValue(valueOffset);
      ignoring = (sensor == 0) ? +1 : -1;
      reference = sensor;
    }
  }
}
int main(void) {
   unsigned int nextTime;
   short flip;

   if (wiringPiSetup () == -1)
    {
      fprintf (stdout, "Unable to start wiringPi: %s\n", strerror (errno)) ;
      fflush(stdout);
      return 1;
    }
   i2c = wiringPiI2CSetup (0x39);
   if (i2c == -1)
    {
      fprintf (stdout, "Unable to start I2C wiringPi: %s\n", strerror (errno)) ;
      fflush(stdout);
      return 1;
    }

    wiringPiI2CWriteReg8(i2c, 0x80, 0x03);
    

    nextTime = millis() + TIME_DELAY+400;
    int x = 0;
    for (;x<500;x++){
      //startReading();
      flip = !flip;
      flipper(flip);
      while (millis() < nextTime) {
      }
      readSensor();
      nextTime+=TIME_DELAY;
    }
}
task main () {

  // declare and initialise the sensor
  tTIR tir;
  initSensor(&tir, S1);

  displayCenteredTextLine(0, "Dexter Industries");
  displayCenteredTextLine(1, "Thermal Infrared");
  displayCenteredTextLine(3, "Test 1");
  displayCenteredTextLine(5, "Connect sensor");
  displayCenteredTextLine(6, "to S1");
  sleep(2000);

  eraseDisplay();

  // set emissivity for light skin
  setEmissivity(&tir, TIR_EM_SKIN_LIGHT);

  sleep(200);

  displayCenteredTextLine(0, "Dexter Industries");
  displayCenteredTextLine(1, "Thermal Infrared");
  while (true) {
    // Read the currently detected ambient and object temp from the sensor
    readSensor(&tir);

    displayTextLine(3, "A: %3.2f", tir.ambientTemp);
    displayTextLine(4, "O: %3.2f", tir.objectTemp);
    sleep(100);
  }
}
task main(){

  // This struct holds all the sensor related data
  tDIMC compass;

  displayCenteredTextLine(0, "Dexter Ind.");
  displayCenteredBigTextLine(1, "dCompass");
  displayCenteredTextLine(3, "Test 1");
  displayCenteredTextLine(5, "Connect sensor");
  displayCenteredTextLine(6, "to S1");
  sleep(2000);
  eraseDisplay();

  // Fire up the compass and initialize it. Only needs to be done once.
  if (!initSensor(&compass, DIMC))
    playSound(soundException);

  sleep(100);
  while (true){

    // Read the Compass
    if (!readSensor(&compass))
      playSound(soundException);

    displayCenteredBigTextLine(2, "%3.2f", compass.heading);
    displayTextLine(5, "%d", compass.axes[0]);
    displayTextLine(6, "%d", compass.axes[1]);
    displayTextLine(7, "%d", compass.axes[2]);
    sleep(50);
  }
}
示例#10
0
/**********************************************************
 * GetHumidity
 *  Gets the current humidity from the sensor.
 *
 * @return float - The relative humidity in %RH
 **********************************************************/
float SHT2xClass::GetHumidity(void)
{
	float data = readSensor(eRHumidityNoHoldCmd);
	if (isnan(data))
		return NAN;
	return (-6.0 + 125.0 * (data / 65536.0));
}
示例#11
0
void DHTSensor::TypeDetection()
{
//Test de detection de modele:
	SensorType = 22;
	readSensor();
//Type de Capteur:
	SensorType = (ErrorLevel==2)?11:(ErrorLevel==3)?0:22;
}
示例#12
0
float getDistanceBySoner()
{
	int analog_input = 0;
	
	analog_input = readSensor(SENSOR_ANALOG_SIGNAL);	//アナログ値取得
	
	return ((6450.0/1023.0)*(float)analog_input);		//アナログ値[v]→距離[mm]		
}
// main task
task main ()
{
  displayCenteredTextLine(0, "HiTechnic");
  displayCenteredBigTextLine(1, "IR Seekr");
  displayCenteredTextLine(3, "Test 1");
  displayCenteredTextLine(5, "Press enter to");
  displayCenteredTextLine(6, "switch between");
  displayCenteredTextLine(7, "600 and 1200 Hz");
  sleep(2000);

  // Create struct to hold sensor data
  tHTIRS2 irSeeker;

  // Initialise and configure struct and port
  initSensor(&irSeeker, S1);

  while(true)
  {
    // You can switch between the two different DSP modes by pressing the
    // orange enter button

    playSound(soundBeepBeep);
    while(bSoundActive)
    {}
    eraseDisplay();

    // display the current DSP mode
    if (irSeeker.mode == DSP_1200)
      displayTextLine(0, "    DC 1200");
    else
      displayTextLine(0, "    DC  600");

    while (true)
    {
      if (getXbuttonValue(xButtonEnter))
      {
        // "Enter" button has been pressed. Need to switch mode

        irSeeker.mode = (irSeeker.mode == DSP_1200) ?  DSP_600 : DSP_1200;
        while(getXbuttonValue(xButtonEnter))
        {
          sleep(1);
        }
        break;
      }

      // Read the sensor data.
      readSensor(&irSeeker);
      displayTextLine(1, "D:%4d %4d 3%d", irSeeker.dcDirection, irSeeker.acDirection, irSeeker.enhDirection);
      displayTextLine(2, "0:%4d %d", irSeeker.dcValues[0], irSeeker.acValues[0]);
      displayTextLine(3, "0:%4d %4d", irSeeker.dcValues[1], irSeeker.acValues[1]);
      displayTextLine(4, "0:%4d %4d %3d", irSeeker.dcValues[2], irSeeker.acValues[2], irSeeker.enhStrength);
      displayTextLine(5, "0:%4d %4d", irSeeker.dcValues[3], irSeeker.acValues[3]);
      displayTextLine(6, "0:%4d %4d", irSeeker.dcValues[4], irSeeker.acValues[4]);
      displayTextLine(7, "Enter to switch");
    }
  }
}
示例#14
0
//AnalogInputに接続した超音波センサから距離を取得するメソッド
double getDistanceBySoner()
{
	int analog_input = 0;
	
	analog_input = readSensor(SENSOR_ANALOG_SIGNAL);	//アナログ値取得
	
	return ((645.0/1023.0)*(double)analog_input);		//アナログ値[v]→距離[cm]	
	
}
示例#15
0
文件: test.c 项目: ktain/Slither
/**
 *	Hug Front Wall
 */
void hugFrontWall(int LSensorVal, int RSensorVal) {
	while (1) {
		int curt = micros(); //start to track time in order to make one adjust every 1000us
		readSensor();
		setLeftPwm(LSensorVal - LFSensor);
		setRightPwm(RSensorVal - RFSensor);
		elapseMicros(1000, curt); //elapse 1000 micro seconds
	}
}
示例#16
0
void DHTSensor::begin(uint8_t ConnectPin)
{
	Pin = ConnectPin;
	TypeDetection();
	delay((SensorType==22)?DHTMaxFreq:0.5*DHTMaxFreq);
	readSensor();
	errorlevel();
	Temp = getTemperature();
	Hum = getTemperature();
}
示例#17
0
task main()
{
    motor[lift] = 0;
    //waitForStart();
    initializeRobot();
    int centerGoal;

    moveForward(2.5);
    wait10Msec(50);
    readSensor(&irSeeker);
    centerGoal = irSeeker.acDirection;
    displayTextLine(1, "D:%4d", irSeeker.acDirection);


    if(centerGoal >= 0 && centerGoal <= 3)
    {
        playSound(soundBeepBeep);
        turnRight(90);
        wait10Msec(50);
        moveForward(1.5);
        wait10Msec(50);

    }
    else if(centerGoal > 3 && centerGoal < 5)
    {
        playSound(soundDownwardTones);
        moveBackward(1);
        wait10Msec(50);
        turnRight(70);
        wait10Msec(50);
        moveForward(2);
        wait10Msec(50);

    }
    else if(centerGoal >= 5 && centerGoal <= 9)
    {
        playSound(soundFastUpwardTones);
        moveBackward(2);
        wait10Msec(50);
        turnRight(90);
        wait10Msec(50);
        moveForward(1);
        wait10Msec(50);

    }
    else
    {
        stopBot();
    }



}
示例#18
0
task main()
{
	// Create struct to hold sensor data
  tHTIRS2 irSeeker;
  // Initialise and configure struct and port
  initSensor(&irSeeker, S3);

	int leftSpeed = 40;
	int rightSpeed = 40;

	OpenWrite(
	while (true)
	{
		int leftSum = irSeeker.dcValues[0] + irSeeker.dcValues[1];
		int rightSum = irSeeker.dcValues[3] + irSeeker.dcValues[4];
		if (leftSum < rightSum && rightSum - leftSum > 22)
		{
			leftSpeed = 40;
			rightSpeed = -40;
		}
		else if (rightSum < leftSum && leftSum - rightSum > 22)
		{
			leftSpeed = -40;
			rightSpeed = 40;
		}
		else
		{
			leftSpeed = -40;
			rightSpeed = -40;
		}

		motor[frontRight] = rightSpeed;
		motor[backRight] = rightSpeed;
		motor[frontLeft] = leftSpeed;
		motor[backLeft] = leftSpeed;

		readSensor(&irSeeker);

		writeDebugStreamLine("irSeeker values");
		for (int i = 0; i < 5; i++)
		{
			writeDebugStreamLine("irSeeker[%d]: %d", i, irSeeker.dcValues[i]);
		}
		for (int i = 0; i < 5; i++)
		{
			writeDebugStreamLine("irSeeker[%d]: %d", i, irSeeker.dcValues[i]);
		}


		writeDebugStreamLine("-----------------------");
		wait1Msec(50);
	}
}
示例#19
0
task main () {
  displayTextLine(0, "HT Gyro");
  displayTextLine(1, "Test 1");
  displayTextLine(5, "Press enter");
  displayTextLine(6, "to set relative");
  displayTextLine(7, "heading");

  sleep(2000);
  eraseDisplay();

  // Create struct to hold sensor data
  tHTGYRO gyroSensor;

  // Initialise and configure struct and port
  initSensor(&gyroSensor, S1);

  time1[T1] = 0;
  while(true) {
    if (time1[T1] > 1000) {
      eraseDisplay();
      displayTextLine(1, "Resetting");
      displayTextLine(1, "offset");
      sleep(500);

      // Start the calibration and display the offset
      sensorCalibrate(&gyroSensor);

      displayTextLine(2, "Offset: %f", gyroSensor.offset);
      playSound(soundBlip);
      while(bSoundActive) sleep(1);
      time1[T1] = 0;
    }

    while(!getXbuttonValue(xButtonEnter)) {
      eraseDisplay();

      displayTextLine(1, "Reading");

      // Read the current rotational speed
      readSensor(&gyroSensor);

      // Read the current calibration offset and display it
      displayTextLine(2, "Offset: %4f", gyroSensor.offset);

      displayClearTextLine(4);
      // Read the current rotational speed and display it
      displayTextLine(4, "Gyro:   %4f", gyroSensor.rotation);
      displayTextLine(6, "Press enter");
      displayTextLine(7, "to recalibrate");
      sleep(100);
    }
  }
}
示例#20
0
void Maxbotix::readSample()
{
    // read
    for (int i = 0; i < sample_size; i++) {
        sample[i] = readSensor();

        if (input == AN && i != sample_size - 1)
            delay(ad_sample_delay);
    }

    // sort
    sortSample();
}
示例#21
0
/* * * * * * * * * *
 * Systick Handler *
 * * * * * * * * * */
void systick()
{
	if (b_useIR)
	{
		readSensor();
	}
	if (b_useGyro)
	{
		readGyro();
	}
	if (b_useSpeedProfile)
	{
		speedProfile();
	}
}
// main task
task main ()
{
  displayCenteredTextLine(0, "HiTechnic");
  displayCenteredBigTextLine(1, "IRSeekr2");
  displayCenteredTextLine(3, "SMUX Test");
  displayCenteredTextLine(5, "Connect SMUX to");
  displayCenteredTextLine(6, "S1 and sensor to");
  displayCenteredTextLine(7, "SMUX Port 1");
  sleep(2000);

  // Create struct to hold sensor data
  tHTIRS2 irSeeker;

	// The sensor is connected to the first port
	// of the SMUX which is connected to the NXT port S1.
	// To access that sensor, we must use msensor_S1_1.  If the sensor
	// were connected to 3rd port of the SMUX connected to the NXT port S4,
	// we would use msensor_S4_3

  // Initialise and configure struct and port
  initSensor(&irSeeker, msensor_S3_2);
  wait1Msec(2000);
  eraseDisplay();
  time1[T1] = 0;
    // You can switch between the two different DSP modes by pressing the
    // orange enter button

    playSound(soundBeepBeep);
    while(bSoundActive)
    {}
    eraseDisplay();

    displayCenteredTextLine(0, "DC 1200");

    while (true)
    {
      // Read the sensor data.
      readSensor(&irSeeker);
      displayTextLine(1, "D:%4d:%4d:3%d", irSeeker.dcDirection, irSeeker.acDirection, irSeeker.enhDirection);
      displayTextLine(2, "0:%4d:%d", irSeeker.dcValues[0], irSeeker.acValues[0]);
      displayTextLine(3, "0:%4d:%4d", irSeeker.dcValues[1], irSeeker.acValues[1]);
      displayTextLine(4, "0:%4d:%4d:%3d", irSeeker.dcValues[2], irSeeker.acValues[2], irSeeker.enhStrength);
      displayTextLine(5, "0:%4d:%4d", irSeeker.dcValues[3], irSeeker.acValues[3]);
      displayTextLine(6, "0:%4d:%4d", irSeeker.dcValues[4], irSeeker.acValues[4]);
      displayTextLine(7, "Enter to switch");
      sleep(500);
    }
  }
示例#23
0
void DHT::setup(uint8_t pin, DHT_MODEL_t model)
{
  DHT::pin = pin;
  DHT::model = model;
  DHT::resetTimer(); // Make sure we do read the sensor in the next readSensor()

  if ( model == AUTO_DETECT) {
    DHT::model = DHT22;
    readSensor();
    if ( error == ERROR_TIMEOUT ) {
      DHT::model = DHT11;
      // Warning: in case we auto detect a DHT11, you should wait at least 1000 msec
      // before your first read request. Otherwise you will get a time out error.
    }
  }
}
示例#24
0
int main(void)
{
  int value = 1;

  // Setup the sensor ready for captures
  setup();

  // Loop forever
  while(1) {
    uint32_t sensorDiff[8] = {0};

    // Read in the current sensor reading
    readSensor(sensorDiff);

    std::cout << "Sensor values ";

    // Go through each sensor, outputting its level
    for(size_t i = 0; i < 8; i++) {
      if(sensorDiff[i] <= WHITE_LEVEL) {
        std::cout << "0";
      }
      else {
        std::cout << "1";
      }

      if(i < 7) {
        std::cout << ":";
      }

    }

    std::cout << std::endl;

    // Sleep for a second before taking the next reading
    sleep(1);
  }

  // We currently never get here, but if in future we
  // do then tidy up
  gpioNotifyClose(notifyPipe);

  gpioTerminate();

  return EXIT_SUCCESS;
}
示例#25
0
文件: main.cpp 项目: PinkPR/Elec
void loop()
{
	byte payload[PAYLOAD_SIZE];
	int *payload_int = (int *) payload;

	listen(payload);

	if (payload[0] >= SENSOR_CNT)
	{
		payload[0] = (byte) 'E';
		send(payload);
	}
	else
	{
		payload_int[0] = readSensor(payload[0]);
		send(payload);
	}
}
task main () {
  string _tmp;

  displayCenteredTextLine(0, "HiTechnic");
  displayCenteredBigTextLine(1, "Color V2");
  displayCenteredTextLine(3, "Test 1");
  displayCenteredTextLine(5, "Connect sensor");
  displayCenteredTextLine(6, "to S1");
  sleep(2000);

  // Create struct to hold sensor data
  tHTCS2 colorSensor;

  // Initialise and configure struct and port
  initSensor(&colorSensor, S1);

  eraseDisplay();
  while (true)
  {
    // Read the currently detected colour and RGB/HSV data from the sensor
    if (!readSensor(&colorSensor)) {
      displayTextLine(4, "ERROR!!");
      sleep(2000);
      stopAllTasks();
    }

    displayCenteredTextLine(0, "Color: %d", colorSensor.color);
    displayCenteredBigTextLine(1, "R  G  B");

    eraseRect(0,10, 99, 41);
    fillRect( 0, 10, 30, 10 + (colorSensor.red+1)/8);
    fillRect(35, 10, 65, 10 + (colorSensor.green+1)/8);
    fillRect(70, 10, 99, 10 + (colorSensor.blue+1)/8);
    StringFormat(_tmp, " %3d   %3d", colorSensor.red, colorSensor.green);
    displayTextLine(7, "%s   %3d", _tmp, colorSensor.blue);

    sleep(100);
  }
}
示例#27
0
// The real aquire function	
Humiditysensor DHTHUMIDITY::readHumidity()
{
	float u,t;
	if (readSensor()) {
	    switch (sensor.Type) {
		case DHT11:
			u = data[0];
			t = data[2];
			break;
		case DHT22:
		case DHT21:
			u = data[0];
			u *= 256;
			u += data[1];
			u /= 10;
			t = data[2] & 0x7F;
			t *= 256;
			t += data[3];
			t /= 10;
			if (data[2] & 0x80) t *= -1;
			break;
		default:
			u = 0;
			t = 0;
			break;
	    }
	} else {
		Serial.print("Read fail");
		u = -1;
		t = -1;
	}

	sensor.TemperatureC = t;
	sensor.TemperatureF = convertCtoF(t);
	sensor.Humidity = u;

	return(sensor);
}
示例#28
0
float Maxbotix::getRange()
{
    float range;

    readSample();

    switch (filter) {
    case MEDIAN:
        range = getSampleMedian();
        break;

    case HIGHEST_MODE:
        range = getSampleMode(true);
        break;

    case LOWEST_MODE:
        range = getSampleMode(false);
        break;

    case SIMPLE:
        while (sample[0] != sample[sample_size - 1])
            pushToSample(readSensor());

        range = sample[0];
        break;

    case BEST:
        range = getSampleBest();
        break;

    case NONE:
    default:
        range = sample[0];
        break;
    }

    return range;
}
task main () {
  displayCenteredTextLine(0, "HiTechnic");
  displayCenteredBigTextLine(1, "TMUX");
  displayCenteredTextLine(3, "Test 1");
  displayCenteredTextLine(5, "This is for the");
  displayCenteredTextLine(6, "Touch MUX");
  sleep(2000);

  // Create struct to hold sensor data
  tHTTMUX touchMUX;

  // Initialise and configure struct and port
  initSensor(&touchMUX, S1);

  while (true) {
    eraseDisplay();
    displayTextLine(0, "HT Touch MUX");

    // Read the data from the sensor
    readSensor(&touchMUX);

    // Go through each possible touch switch attached to the TMUX
    // and display whether or not is active (pressed)
    for (short i = 0; i < 4; i++) {
      if (touchMUX.status[i])
        displayTextLine(i+2, "Touch %d: on", i+1);
      else
        displayTextLine(i+2, "Touch %d: off", i+1);
    }

    // Display the binary value of the active touch switches
    // 0 = no touch, 1 = touch 1 active, 2 = touch 2 active, etc.
    // touch 1 + touch 2 active = 1 + 2 = 3.
    displayTextLine(7, "Mask: %d", touchMUX.statusMask);
    sleep(50);
  }
}
task main () {
  displayCenteredTextLine(0, "HiTechnic");
  displayCenteredBigTextLine(1, "Accel");
  displayCenteredTextLine(3, "Test 1");
  displayCenteredTextLine(5, "Connect sensor");
  displayCenteredTextLine(6, "to S1");
  sleep(2000);

  playSound(soundBeepBeep);
  while(bSoundActive) sleep(1);

  // Create struct to hold sensor data
  tHTAC accelerometer;

  // Initialise and configure struct and port
  initSensor(&accelerometer, S1);

  while (true) {
    eraseDisplay();

    // Read all of the axes at once
    if (!readSensor(&accelerometer)) {
      displayTextLine(4, "ERROR!!");
      sleep(2000);
      stopAllTasks();
    }

    displayTextLine(0,"HTAC Test 1");
    displayTextLine(2, "   X    Y    Z");

    displayTextLine(3, "%4d %4d %4d", accelerometer.x, accelerometer.y, accelerometer.z);
		// Alternatively, you can read them like this:
    displayTextLine(4, "%4d %4d %4d", accelerometer.axes[0], accelerometer.axes[1], accelerometer.axes[2]);
    sleep(100);
  }
}