Programming on Uno vs Pro Mini

Hi,
So i Have a program made using an altimeter that inputs data into the Arduino Uno and then the Arduino reads that data and when the height is over 3 feet it sends an output. This code works perfectly on the Arduino Uno, but when I download the code to the Pro Mini (after changing the board and port), the program no longer works. Am I missing something? if it works on the Uno should it not also work on the Pro Mini?

Just FYI the altimeter is the pnut altimeter the manual is at this link: http://www.perfectflite.com/Downloads/Pnut%20manual.pdf and the telemetry information for coding starts on page 16.

Thanks for any help.

Here is the code:
String inputString = “”; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete

void setup() {

pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);

// initialize serial:
Serial.begin(9600);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
}

void loop() {
// print the string when a newline arrives:
if (stringComplete) {
if (inputString.toInt() > 3) {
eject();
}
Serial.print(inputString);
// clear the string:
inputString = “”;
stringComplete = false;
}
}

void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == ‘\n’) {
stringComplete = true;
}
}
}

void eject() {
Serial.println(“EJECT2”);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
}

In setup(), you’re setting pins 2-8 as outputs, but in eject(), you’re writing to pins 3-9. Are you sure this worked before, or did you perhaps forget to tweak something when switching boards?

Hi,

Thanks for your quick response.

Thanks for catching that error with the outputs and pinmodes but I still have the same issue where the program works perfectly on the Arduino Uno, but when I switch it over to the Arduino Pro Mini it doesnt work.

Thanks for any help you can provide.

Does the Pro Mini work with other sketches? If not, the Pro Mini may be bad.

How are you powering the Mini?

.

Yes I can get the Pro Mini to run other sketches.

I am powering the Pro Mini with the usb cable.

I also power the Pro Mini with a 9V battery plugged into the ground and VCC ports.

A Pro Mini doesn't have a USB connector, it uses FTDI.

.

Well yes, I meant that I had the FTDI to usb thing plugged into the Arduino Pro Mini and then had the usb cord plugged into the computer from there.

Hey there, dratze, I think the ball's in your court now. You mentioned that the Pro Mini runs other sketches. The sketch you're having trouble with is not large, so it ought not to take long to isolate the part that isn't doing what you expect. (I suppose it's a bit late to mention that you haven't defined "doesn't work." What exactly does that mean in this case?)

EDIT: One other thought: You didn't perhaps get yourself the 3.3V version of the Pro Mini, did you? (Which box is checked on the back of the board?) As a drop-in replacement for a 5V Uno, a 3.3V Pro Mini would be a rather troublesome choice.