Skip to content

Instantly share code, notes, and snippets.

@NicoHood
Created September 15, 2015 18:29
// arduino uno, 64 byte serial tx rx buffers, default
const int dledPin = 12;
const int ledPin = 13;
bool ledState = LOW;
unsigned long previousMillis = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(dledPin, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(dledPin, 0);
Serial.begin(2000000);
}
void loop() {
unsigned long currentMillis = millis();
if ((currentMillis - previousMillis) >= 1000) {
ledState = !ledState;
digitalWrite(dledPin, 1);
for (int i = 0; i < 500; i++) {
Serial.write('a');
//digitalWrite(dledPin, 0);
Serial.flush();
//digitalWrite(dledPin, 1);
delay(6);
}
digitalWrite(dledPin, 1);
previousMillis = millis();
digitalWrite(ledPin, ledState);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment