Advertisement
GUPPYYYY

Line Arrays

Sep 9th, 2024
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <QTRSensors.h>
  2.  
  3.  
  4. QTRSensors qtr;
  5.  
  6.  
  7.  
  8. const uint8_t SensorCount = 4;
  9.  
  10. uint16_t sensorValues[SensorCount];
  11.  
  12.  
  13.  
  14. void setup()
  15.  
  16. {
  17.  
  18. qtr.setTypeRC();
  19.  
  20. qtr.setSensorPins((const uint8_t[]){4, 5, 6, 7}, SensorCount);
  21.  
  22. Serial.begin(9600);
  23.  
  24. }
  25.  
  26.  
  27.  
  28. void loop()
  29.  
  30. {
  31.  
  32.  
  33. qtr.read(sensorValues);
  34.  
  35.  
  36.  
  37. for (uint8_t i = 0; i < SensorCount; i++)
  38.  
  39. {
  40.  
  41. Serial.print(sensorValues[i]);
  42.  
  43. Serial.print('\t');
  44.  
  45. }
  46.  
  47. Serial.println();
  48.  
  49.  
  50.  
  51. delay(250);
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement