Skip to content

Instantly share code, notes, and snippets.

@eggie5
Created March 29, 2014 17:41
Show Gist options
  • Select an option

  • Save eggie5/9858756 to your computer and use it in GitHub Desktop.

Select an option

Save eggie5/9858756 to your computer and use it in GitHub Desktop.
connect to a USB host over serial arduino
uint8_t counter;
void setup() {
Serial.begin(115200);
SerialUSB.begin(115200); // speed is irrelevant for native port
counter = 0;
}
byte lat;
void loop() {
Serial.print("Programming port. Counter is at ");
Serial.println( counter);
// SerialUSB.print("Native port. Counter is at ");
//SerialUSB.println( counter);
while(SerialUSB.peek()!=-1)
{
lat = SerialUSB.read();
SerialUSB.print("new byte is:");
SerialUSB.println(lat);
}
//counter++;
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment