I’m currently working on a project at school which involves making a Flight Simulator.
For this project an Arduino is used to read values from a usb joystick and convert them to 0-5v output for both pitch and roll.
We are using this instructable to do the project.https://www.instructables.com/id/Arduino-Pneumatic-Flight-Simulator/
In this instructable they’ve already made an Arduino program and another program for the USB joystick.
But when I try to compile the Arduino program, I spit out some errors. As I’m not that familiar which this kind of Arduino code, I’d like some help.
FlightSimulator_arduino.pde (2.78 KB)
program.zip (61.5 KB)
I, for one, am not going to open a zip file from someone I don't know, without knowing what is in the zip file.
The extension for Arduino scripts has been .ino for years, so that is a very old project you are trying to replicate.
What value is there is re-doing something someone else has already done? What are you learning from that?
Having said all that, you forgot to post the error messages you are getting.
This will let you compile it:
float getFloatFromSerialMonitor() // this function parses and converts voltages
float f = 0;
int x = 0;
while (x < 1)
delay(5); //lower the better
int i = 0;
while (Serial.available() > 0)
char inByte = Serial.read();
inData[i] = inByte;
i += 1;
x = 2;
inData[i] = 0;
f = atof(inData);
}//END WHILE X<1
Given that there were three serious bugs in that function and that it’s using delay to try and ensure that once once character has been received, all are, I’d be inclined to throw the whole thing out and start from scratch.
Edit: fixed another issue.
Was that uncompileable sketch actual published somewhere for others to use, or did you just find it in some random place as perhaps a work-in-progress?
float getFloatFromSerialMonitor() // this function wastes a lot of time
Unfortunately parseFloat() is not useful in anything but the smallest problems.
But when I try to compile the Arduino program, I spit out some errors.
Well, tell us what the errors are.