Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. using System;
  2. using System.Reflection;
  3. using System.Runtime.CompilerServices;
  4.  
  5. namespace ConsoleApp1
  6. {
  7. class Program
  8. {
  9. static void Print(float str)
  10. {
  11. Console.Write(str);
  12. }
  13.  
  14. static bool CheckRain()
  15. {
  16. //int pin = ...;
  17. // pinMode(pin, INPUT);
  18. // int indicateur = analogRead(pin);
  19. int indicateur = 0;
  20. return indicateur == 0;
  21. }
  22.  
  23. static bool CheckTemperature()
  24. {
  25. // int pin = ...;
  26. // pinMode(pin, INPUT);
  27. // int temp = analogRead(pin);
  28. int temp = 0;
  29.  
  30. if (temp < 3)
  31. return true;
  32. return false;
  33. }
  34.  
  35. static bool CheckHumidity()
  36. {
  37. // int pin = ...;
  38. // pinMode(pin, INPUT);
  39. // int humidity = analogRead(pin);
  40. int humidity = 0;
  41.  
  42. if (humidity > 0.6)
  43. return true;
  44. return false;
  45. }
  46.  
  47. static bool CheckWind()
  48. {
  49. // int pin = ...;
  50. // pinMode(pin, INPUT);
  51. // int humidity = analogRead(pin);
  52. float wind = 0;
  53.  
  54. if (wind > 0.9)
  55. return true;
  56. return false;
  57. }
  58.  
  59. static int Yes()
  60. {
  61. bool temp = CheckTemperature();
  62. if (temp)
  63. return 110;
  64. return 120;
  65. }
  66.  
  67. static int No()
  68. {
  69. bool humidity = CheckHumidity();
  70.  
  71. if (humidity)
  72. {
  73. bool temp = CheckTemperature();
  74. if (temp)
  75. return 110;
  76. bool wind = CheckWind();
  77. if (wind)
  78. return 110;
  79. return 120;
  80. }
  81. else
  82. {
  83. bool wind = CheckWind();
  84. if (wind)
  85. return 120;
  86. return 130;
  87. }
  88. }
  89.  
  90. static void Setup()
  91. {
  92. // Serial.begin(9600);
  93. }
  94.  
  95. static void Loop()
  96. {
  97. bool isRain = CheckRain();
  98.  
  99. if (isRain)
  100. Print(Yes());
  101. else
  102. Print(No());
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement