Digital Statement

Reads the value of a specified digital port. The value returned will be either a 1 or 0 depending on the state of the digital sensor.

Syntax

  1. digital('digital port');

Example

  1. //Move forward until the digital sensor detects a wall.
  2. void main()
  3. {
    1. motor(2,95);
    2. motor(4,95);
    3. while(!digital(8))
      1. sleep(0.5);
    4. ao();
  4. }