Facebook
From Thiego de Sousa, 2 Years ago, written in Plain Text.
This paste is a reply to Campo Minado from Thiego de Sousa - view diff
Embed
Download Paste or View Raw
Hits: 241
  1. int analog = A0;
  2. int numero;
  3. int estado;
  4.  
  5. void setup()
  6. {
  7.   //numero = random(8,14);
  8.   Serial.begin(9600);
  9.   pinMode(2, OUTPUT);
  10.   pinMode(3, OUTPUT);
  11.  
  12.   pinMode(8, INPUT);
  13.   pinMode(9, INPUT);
  14.   pinMode(10, INPUT);
  15.   pinMode(11, INPUT);
  16.   pinMode(12, INPUT);
  17.   pinMode(13, INPUT);
  18.  
  19.   digitalWrite(2, HIGH);
  20.   randomSeed(analogRead(analog));
  21.   numero = random(8,14);
  22. }
  23.  
  24. void loop()
  25. {
  26.  estado = digitalRead(numero);
  27.  Serial.println(numero);
  28.  Serial.println(estado);
  29.  if(estado == 1)
  30.  {
  31.   digitalWrite(3, HIGH);
  32.   delay(100);
  33.   digitalWrite(2, LOW);
  34.   delay(1000);
  35.   numero = random(8,14);
  36.  }
  37.  else
  38.  {
  39.   digitalWrite(2, HIGH);
  40.   delay(100);
  41.   digitalWrite(3, LOW);
  42.   delay(100);
  43.  }
  44.  }

Replies to Re: Campo Minado rss

Title Name Language When
Campo Minado Thiego de Sousa text 2 Years ago.