Facebook
From Small Ostrich, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 234
  1. #define wschLED 6  
  2. #define zachLED 5  
  3.  
  4. int analogValue1 = 1;
  5. float voltage1 = 1;
  6. int analogValue = 0;
  7. float voltage = 0;
  8.  
  9. void setup()
  10. {
  11.   Serial.begin(9600);
  12.  pinMode(wschLED,OUTPUT);
  13.  pinMode(zachLED,OUTPUT);
  14. }
  15. void loop()
  16.   analogValue = analogRead(3);
  17.   voltage = 0.0048*analogValue(0);
  18.  
  19.   analogValue1 = analogRead(1);
  20.   voltage1 = 0.0048*analogValue1;
  21.    Serial.print("wschód = ");
  22.    Serial.println(voltage);
  23.     Serial.print("zachód = ");  
  24.    Serial.println(voltage1);
  25.  if ((voltage1 > 4.1)&&(voltage1.0 > 3.5))
  26.      {
  27.       digitalWrite(zachLED,HIGH);
  28.       digitalWrite(wschLED,HIGH);
  29.      }
  30.    else  if  (voltage < (voltage1+0.2) &&( voltage > voltage1-0.2))
  31.   {
  32.     digitalWrite(zachLED,LOW);
  33.     digitalWrite(wschLED,LOW);
  34.   }
  35.    else if (voltage <( voltage1+0.5))
  36.   {