Skip to content

Instantly share code, notes, and snippets.

@kik
Created June 15, 2012 15:51
Show Gist options
  • Select an option

  • Save kik/2937189 to your computer and use it in GitHub Desktop.

Select an option

Save kik/2937189 to your computer and use it in GitHub Desktop.
Arduinoかんたん
int sc_rst = 2;
byte read_rst() {
return digitalRead(sc_rst);
}
void setup() {
Serial.begin(9600);
pinMode(sc_rst, INPUT);
while (read_rst())
;
}
void loop() {
if (!read_rst()) {
while (!read_rst())
;
Serial.println("SC Reset");
Serial1.begin(10752);
UCSR1C |= B00101000;
while (read_rst()) {
if (Serial1.available() > 0) {
byte r = Serial1.read();
Serial.print("recv: ");
Serial.println(r, HEX);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment