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);
}