Skip to content

Instantly share code, notes, and snippets.

@giljr
Created April 8, 2017 15:27
Show Gist options
  • Save giljr/1f350b44200f0c907f17c6aa08096a19 to your computer and use it in GitHub Desktop.
Save giljr/1f350b44200f0c907f17c6aa08096a19 to your computer and use it in GitHub Desktop.
#include <FlexiTimer2.h> // use timer for sampling to get even time base for data
const int READ_SINE_PIN = A0;
const int READ_OUTPUT_PIN = A1;
int inverted_value = 0;
void setup() {
Serial.begin(115200); // initialize serial communications (to match that used by PlotNValues.pde)
FlexiTimer2::set(10, sample);
FlexiTimer2::start();
}
void loop() {
//wait interruption
}
// sample values and pipe to processing
void sample() {
String result = "";
Serial.println(result + analogRead(READ_SINE_PIN) + "," + analogRead(READ_OUTPUT_PIN));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment