Advertisement
Guest User

hej

a guest
Sep 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. int analogPin = A1;
  2. int buzz = 8;
  3. long buzzing = 300;
  4. float lowest = 0;
  5. float highest = 1023.0;
  6. int knowohm;
  7.  
  8.  
  9. void setup() {
  10. Serial.begin(9600);
  11. Serial.println("Started");
  12. pinMode(buzz, OUTPUT);
  13. }
  14.  
  15. void loop() {
  16. int readvolt = analogRead(analogPin);
  17. // Serial.println(in);
  18. float voltage = 5 * (readvolt / 1023.0);
  19. Serial.println(voltage);
  20. Serial.println(readvolt);
  21.  
  22.  
  23.  
  24. //float k = (4000 - 50) / (highest - lowest); //
  25. //float hz = k * (in - lowest) + 50;
  26.  
  27.  
  28. //float ohm = (1000 * (5 - voltage)) / voltage;
  29. float ohm = ((5 - voltage)*1000)/voltage;
  30.  
  31.  
  32. //Serial.println(hz);
  33. Serial.println(ohm);
  34. //tone(buzz, hz,buzzing);
  35.  
  36. delay(2500);
  37.  
  38. }
  39. void Print(int a, float b, float c, int d)
  40. {
  41. Serial.print(a);
  42. Serial.print(" ");
  43. Serial.print(b);
  44. Serial.print(" ");
  45. Serial.print(c);
  46. Serial.print(" ");
  47. Serial.print(d);
  48. Serial.println();
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement