Steven-
The Arduino module works great for my project. I just have one problem with it. I am using an ultrasonic sensor that needs special code on the Arduino Mega to output the distance. This code is:
**************************************
const int pingPin = 8;//output cable
const int inputPin = 31;//input cable
void setup() {
// initialize serial communication:
Serial.begin(9600);
}
void loop()
{
long duration, inches, cm;
pinMode(inputPin, OUTPUT);
digitalWrite(inputPin, LOW);
delayMicroseconds(2);
digitalWrite(inputPin, HIGH);
delayMicroseconds(5);
digitalWrite(inputPin, LOW);
/
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);
// convert the time into a distance
inches = microsecondsToInches(duration);
Serial.print(inches);
Serial.println();
delay(100);
}
long microsecondsToInches(long microseconds)
{
return microseconds / 74 / 2;
}
*************************************
I am unsure how to combine this code with the RoboRealm Mega Sketch.
Or to be more broad, is there any way a user can add their own custom code to the Mega Sketch and have it implemented in the Mega Module? i.e. combining the MCU Communicator and Arduino Mega modules?
Thanks a lot,
-Carl H.
|
|