wiki:wade/embedded/arduino/example/example_10_1_IR
close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_fs.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.

Version 2 (modified by wade, 16 years ago) (diff)

--

回到 Arduino

Source code

void setup()
{
  pinMode(9, OUTPUT);
  //pinMode(8, OUTPUT);
  pinMode(2, INPUT);
}
boolean val1 = 1;
//boolean val2 = 1;
void loop()
{
  digitalWrite(9, val1^=1);
  //digitalWrite(8, val2^=1);
  if (digitalRead(2) == LOW)
    digitalWrite(13, HIGH);
  else
    digitalWrite(13, LOW);
  //delayMicroseconds(1);
}