Skip to content

Instantly share code, notes, and snippets.

@chrismeyersfsu
Created August 6, 2012 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismeyersfsu/3270418 to your computer and use it in GitHub Desktop.
Save chrismeyersfsu/3270418 to your computer and use it in GitHub Desktop.
Arduino Poor man's oscilloscope with verification generator
// The Arduino code.
#define ANALOG_IN 0
int outPin=13;
int outPinState = LOW;
int count = 1;
int every = 10000;
void setup() {
//Serial.begin(9600);
Serial.begin(115200);
}
void loop() {
int val = analogRead(ANALOG_IN);
Serial.write( 0xff );
Serial.write( (val >> 8) & 0xff );
Serial.write( val & 0xff );
/* Generate signal to test oscilloscope */
if ((count % every) == 0) {
if (outPinState == LOW) {
outPinState = HIGH;
} else {
outPinState = LOW;
}
digitalWrite(outPin, outPinState);
count = 0;
}
count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment