PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

serialInterval.pde 607B

3 jaren geleden
1234567891011121314151617181920212223
  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(' ');
  13. }
  14. // Terminate message with a linefeed and a carriage return
  15. Serial.println();
  16. }
  17. }