Created
March 30, 2011 06:41
-
-
Save anonymous/893962 to your computer and use it in GitHub Desktop.
Arduino sketch for serial passthrough
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
/************************************************** | |
* Simple pass-through serial application for | |
* Arduino and Arduino-clones. | |
* You can use this for testing and | |
* updating the Rogue Robotics | |
* uMMC Serial Data Module or | |
* uMP3 Playback Module. | |
* | |
* You will need the "NewSoftSerial" library | |
* available at the Arduino website. | |
* http://arduino.cc/ | |
* http://arduino.cc/en/Reference/Libraries | |
***************************************************/ | |
#include <NewSoftSerial.h> | |
// You can set this to whatever pins you have the uMMC or uMP3 connected. | |
// e.g. 4 is connected to uMMC "T", 5 is connected to uMMC "R" | |
NewSoftSerial out(7, 8); | |
// If you are using this to update the firmware on the uMMC or uMP3, | |
// you will have to make sure that both the Serial connection and the | |
// out connection are set to 9600 bps. | |
void setup() | |
{ | |
out.begin(19200); | |
Serial.begin(19200); | |
// pinMode(13, OUTPUT); | |
// digitalWrite(13, 0);s | |
} | |
void loop() | |
{ | |
// digitalWrite(13, 0); | |
if(out.available()) | |
{ | |
// digitalWrite(13, 1); | |
Serial.print((uint8_t)out.read()); | |
} | |
if(Serial.available()) | |
{ | |
// digitalWrite(13, 1); | |
out.print((uint8_t)Serial.read()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Correct loop: