Skip to content

Instantly share code, notes, and snippets.

@arduinoboard
Last active August 29, 2015 14:16
Show Gist options
  • Save arduinoboard/fbd7012d589a5b4d212d to your computer and use it in GitHub Desktop.
Save arduinoboard/fbd7012d589a5b4d212d to your computer and use it in GitHub Desktop.
The file that is currently on an Arduino Duemilanove w/ ATmega328 with a serial number of A900acu7
/* code is based on info here:
* http://arduino.cc/en/Reference/softwareSerial
*
* Serial VM2 to IDE sketch
* Arduino just sits in the middle & relays serial
* data to and fro from the VMUSIC2
*/
/*
* 2015.03.14
* uses Streaming library (for << operator)
* http://arduiniana.org/libraries/streaming/
* using DebugUtils too
*
* NextAction: Look at implemening the ping fnVMusic2PingsOK
* requirements:
* Req1:communicating with 2 serial ports.
* Req2: piping the reply from the VM2 to the IDESerialMonitor
*
* Basically works: typing a <CR> in the Serial monitor makes
* the VMUSIC2 reply with D:\>
*/
#define DEBUG
#include <DebugUtils.h>
// DEBUG_PROFILE_PRINTLN();
#include <Streaming.h>
#include <SoftwareSerial.h>
const char VMUSIC_RX=12; //to VMUSIC TXD pin YEL wire
const char VMUSIC_TX=11; //to VMUSIC RXD pin ORA
boolean bVMusic2OK=0;
//instantiate SoftwareSerial
SoftwareSerial mySerial(VMUSIC_RX, VMUSIC_TX);
//syntax SoftwareSerial(receivePin, transmitPin)
void setup()
// run once, when the sketch starts
{
Serial.begin(9600); // Initialize serial port to send and receive at 9600 baud
Serial.println("Ready! ver2015.03.14.001");
delay(2000); // Give reader a chance to see the output.
//set the data trate for the SoftwareSerial port
mySerial.begin(9600); //could be set to a different rate if we want
}
void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment