Analog Statement

Reads the value of a specified analog port. The value returned will be between 0 and 255 depending on the state of the analog sensor.

Syntax

  1. analog('analog port');

Example

  1. //Follow a circle created with a black line.
  2. void main()
  3. {
    1. motor(2,95);
    2. motor(4,95);
    3. while(1)
    4. {
      1. if(analog(3)<150)
        1. motor(2,15);
      2. else
        1. motor(2,95);
    5. }
  4. }