Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

StreamParseInt.ino 862B

10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
12345678910111213141516171819202122232425262728293031323334
  1. // Simple demo of the Stream parsInt() member function.
  2. #include <SdFat.h>
  3. // SD card chip select pin - Modify the value of csPin for your SD module.
  4. const uint8_t csPin = 10;
  5. SdFat SD;
  6. File file;
  7. //------------------------------------------------------------------------------
  8. void setup() {
  9. Serial.begin(9600);
  10. // Initialize the SD.
  11. if (!SD.begin(csPin)) {
  12. Serial.println(F("begin error"));
  13. return;
  14. }
  15. // Create and open the file. Use flag to truncate an existing file.
  16. if (!file.open("stream.txt", O_RDWR|O_CREAT|O_TRUNC)) {
  17. Serial.println(F("open error"));
  18. return;
  19. }
  20. // Write a test number to the file.
  21. file.println("12345");
  22. // Rewind the file and read the number with parseInt().
  23. file.rewind();
  24. int i = file.parseInt();
  25. Serial.print(F("parseInt: "));
  26. Serial.println(i);
  27. file.close();
  28. }
  29. void loop() {}