serialInterval.pde 646 B

123456789101112131415161718192021222324
  1. // This example sends a Serial message every 250 milliseconds
  2. #include <Metro.h> // Include the Metro library
  3. Metro serialMetro = Metro(250); // Instantiate an instance
  4. void setup() {
  5. Serial.begin(115200); // Start the Serial communication
  6. }
  7. void loop() {
  8. if (serialMetro.check() == 1) { // check if the metro has passed it's interval .
  9. // Output all the analog readings seperated by a space character
  10. for (int i = 0; i < 6; i++ ) {
  11. Serial.print (analogRead( i) );
  12. Serial.print(32,BYTE);
  13. }
  14. // Terminate message with a linefeed and a carriage return
  15. Serial.print(13,BYTE);
  16. Serial.print(10,BYTE);
  17. }
  18. }