Пример #1
0
void IRSensorDemo(void) {
    Printf("Press any key to quit\n");
        
      while(!KeyWasPressed()) {
        float ADCValue = ADCRead(adc[0]);
        Printf("IR values: %d\t", (int)(1000 * ADCValue));
        ADCValue = ADCRead(adc[1]);
        Printf(" %d\t", (int)(1000 * ADCValue));
        ADCValue = ADCRead(adc[2]);
        Printf(" %d\t", (int)(1000 * ADCValue));
        ADCValue = ADCRead(adc[3]);
        Printf(" %d\r", (int)(1000 * ADCValue));
    }  
    Printf("\n");
}
Пример #2
0
void gpioDemo(void) {
    Printf("Press:\nany key-read port A values\n");
    Printf("any key after read begins-quit\n");

    while(!KeyWasPressed()) {
        tPin i;
        
        Printf("port A: ");
        for (i = PIN_A0; i <= PIN_A7; i++) {
            Printf(GetPin(i) ? "1" : "0");
        }
        
        Printf("\n");
      }
    
      Printf("\n");
}
Пример #3
0
void IRSensorDemo(void) {
    Printf("Press any key to quit\n");
        
    // loop as long as the user doesn't press a key 
    while (!KeyWasPressed()) {
        Printf(
            "IR values:  front: %1.3f  right: %1.3f  left: %1.3f \r",
            ADCRead(adc[0]),
		 
            ADCRead(adc[1]),
            ADCRead(adc[2])
            //ADCRead(adc[3])
            );
    }
  
    Printf("\n");
}
Пример #4
0
void lineSensorDemo(void) {
    Printf("Press:\nany key-read line sensor\n");
    Printf("any key after read begins-quit\n");
  
    while(!KeyWasPressed()) {
        int i;
        float line[8];
    
        LineSensorReadArray(ls, line);
        Printf("Line Sensor: [");
    
        for (i=0; i < 8; i++) {
            Printf("%01.4f ", line[i]);
        }
    
        Printf("\b]\r");
      }
  
      Printf("\n"); 
}
Пример #5
0
void gpioLineSensorDemo(void) {
    Printf("Press any key to quit\n");
  
    // loop as long as the user doesn't press a key 
    while (!KeyWasPressed()) {
        int i;
        float line[8];
   
        // put the values of the line sensor into the 'line' array 
        LineSensorReadArray(gls, line);
        Printf("Line Sensor: [");
    
        for (i = 0; i < 8; i++) {
            Printf("%.2f ", line[i]);
        }
    
        Printf("\b]        \r");
    }
  
    Printf("\n"); 
}
Пример #6
0
void gpioLineSensorDemo(void) {
    Printf("Press:\nany key-read line sensor\n");
    Printf("any key after read begins-quit\n");
  
    while(!KeyWasPressed()) {
        int i;
        float line[8];
    
        char lineSensorBits = LineSensorRead(gls, 0.8f);
			  LineSensorReadArray(gls, line);
			
        //Printf("Line Sensor: [%d]\r", lineSensorBits);
    
			  Printf("\r");
        for (i=0; i < 8; i++) {
            Printf("%d ", lineSensorBits & (1 << i) ? 1 : 0);
					//Printf("%1.4f ", line[i]);
        }
				Printf("                                     ");
      }
  
      //Printf("\n"); 
}