Advertisement
Ruslan_nig

Arduino read COM

Dec 19th, 2018
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. void setup()
  3.  
  4. {
  5.  
  6.   Serial.begin(9600);
  7.  
  8. }
  9.  
  10. void loop()
  11.  
  12. {
  13.  
  14.   Serial.print ("Enter N: ");
  15.  
  16.   while(!Serial.available());
  17.  
  18.   int N = Serial.parseInt();
  19.  
  20.   Serial.println(N);
  21.  
  22.   Serial.print("Enter R: ");
  23.  
  24.   while(!Serial.available());
  25.  
  26.   int R = Serial.parseInt();
  27.  
  28.   Serial.println(R);
  29.  
  30.   float F = (float)N / R;
  31.  
  32.   Serial.print("Result F: ");
  33.  
  34.   Serial.println(F);
  35.  
  36.   Serial.println();
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement