1234567891011121314151617181920212223 |
- const unsigned long SAMPLE_INTERVAL_MICROSECONDS = 2000L;
- void setup() {
-
- Serial.begin(115200);
- }
- unsigned long last_sample_micros = 0;
- void loop() {
- while (micros() - last_sample_micros < SAMPLE_INTERVAL_MICROSECONDS)
- ;
- last_sample_micros = micros();
-
-
-
- unsigned short reading = analogRead(A0);
-
-
- Serial.write(reading >> 8);
- Serial.write(reading & 0xff);
- }
|