Advertisement
Guest User

termopile

a guest
Feb 14th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. void setup()
  2. {
  3. Serial.begin(9600);  
  4. }
  5. float termometr(){
  6.   float Temp;
  7.   float Volt = (analogRead(0)/1024.0)*5000;
  8.   Temp=(Volt/10)-273.15;
  9.   return Temp;
  10. }
  11.  
  12. void loop()
  13. {
  14.   int petla=0;
  15.   float wynik=0;
  16.   while(petla < 10){
  17.   wynik=wynik+termometr();
  18.     petla++;
  19.     delay(100);
  20.   }
  21.   petla=0;
  22.   float srednia = wynik/10;
  23.   Serial.println(srednia);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement