Arduino code deleted, can I recover it?

So I just opened my file, and realized that the only thing in that file is 'c'. Just that 1 character. I spent a long time on that program, and it was all deleted, for a 'c'. Now, It was uploaded to the Arduino. Is there any way I can get it back? Please help.

Not in a way you could reuse it easily.
Start new from scratch.
Consider to use backups.
Consider to use a software versioning or revision control system.

See also this recent post for similar question: Recover deleted code from Arduino (solved) - #2 by b707

you may get an older copy from your sketch book directory where the code is actually built

on my laptop, that directory is /users/lenovo/AppData/Local/Temp. in that directory are several folders prefixed with "arduino_build_...". there may be a copy of your .ino file under the sketch/ folder

I found a version, thanks so much. But now I get an abnormal error I didn't before.

```cpp
In file included from C:\Users\mcqui\OneDrive\Documents\FlightComputerTVC\FlightComputerTVC.ino:2:0:
C:\Users\mcqui\OneDrive\Documents\Arduino\libraries\MPU6050/MPU6050.h:40:10: fatal error: I2Cdev.h: No such file or directory
 #include "I2Cdev.h"
          ^~~~~~~~~~
compilation terminated.
Multiple libraries were found for "MPU6050.h"
  Used: C:\Users\mcqui\OneDrive\Documents\Arduino\libraries\MPU6050
  Not used: C:\Users\mcqui\OneDrive\Documents\Arduino\libraries\Arduino-MPU6050-master
exit status 1

Compilation error: exit status 1

This didn't happen before.

Move your libraries from OneDrive and put them in the libraries directory of your sketchbook (not sketch).

This is looking for a local copy of the library, in your sketch folder. You may want to use something like

 #include <I2Cdev.h>

Where is the sketchbook folder located?

Wherever you specify in Arduino IDE preferences.

It's myDocuments/Arduino on normal installs. Portable installs are different.

Sorry, I'm still confused on what I am supposed to do. Because in Document/Arduino/Libraries, they are all there; am I supposed to delete the ones in my onedrive or what?

You can put your sketchbook files anywhere you like. You are not "supposed to do" anything.

Set the sketchbook location using the IDE menu Files>Preferences

I would. Arduino and OneDrive do not always play nicely together.

So what is causing this error? It is odd because it did not happen before.

You changed several things at once. We cannot possibly guess what you did, or what you had "before".

You need to focus on restoring the setup in some way that makes sense to you.

Alright, I'll explain. Today when I opened the file FlightComputerTVC.ino (usually working), there was a 'c' inside, no code. So I tried ctrl+z but nothing happened. So I went into the temp files and copy pasted some old code that was essentially the same into the same FlightComputerTVC.ino file. Now, if I try to upload it, I get that error. That is all I did.

It would be a reasonable conclusion that between "before" and "today", several things changed, for some as yet unknown reason.

I do not know anything about OneDrive except that it's somewhere in the cloud (I hate that word).

If there was a glitch syncing your local copy with the copy in the cloud (did I mention that I hate that word) or vice versa, you can end up with corrupt files.

What if I delete the onedrive files? Because it seems the conflict is with, well, conflicting files.

There is no reason to use or delete OneDrive. Just keep everything of interest in whatever folder you decide to use as the sketchbook directory.