Recent Changes - Search:

Video Sites

NCECAYoutubeIndex not maintained

Thai

w0it

pmwiki.org

edit SideBar

RandomNumberif

/*

  RandomNumberif
  Turns on LED on when a random number  is less than 700
  • /

//int LEDinput? = A5; int LEDoutput? = 13;

// the setup routine runs once when you press reset: void setup() {

  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // make the LED input pin an input:
  //pinMode(LEDinput?, INPUT);
  pinMode(LEDoutput?, OUTPUT);

}

// the loop routine runs over and over again forever: void loop() {

  // read the state of the LED input pin. 0 is zero volts. 1023 is 5 volts. 
  //int LEDlevel? = analogRead(LEDinput?);
  // print out the state of the pin from 0 -1023 :
  //Serial.println(LEDlevel?);
         // delay in between reads for stability
  if (random(5000) <700) {
  digitalWrite (LEDoutput?, HIGH);
   delay(500);
  }
  else {
   digitalWrite (LEDoutput?, LOW); 
    delay(500);
  }

} //_________________________________________________________

Edit - History - Print - Recent Changes - Search
Page last modified on November 16, 2021, at 12:11 AM