/serialissue2.ino Secret
Created
September 15, 2015 18:29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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