Can't upload code onto Arduino

I'm relatively new to coding in Arduino and I can't figure out why this code returns an error:

#include <Servo.h>
Servo myServo;                               // This brings an error

void setup(){

void loop(){
  delay(1000);                                  // This brings an error
  delay(1000);                                  // This brings an error

This code supposedly moves a servo motor back and forth. I used a simulator (Tinkercad) to test this code and it worked perfectly fine! But for some reason I can't upload it onto the Arduino.

I think it has something to do with the Libraries but, as I said before, I am pretty new to this kind of stuff.

Can you upload a simple sketch like blink?

Can you tell us the error so we don't have to guess. If there is an error, there is a "copy error message" button at the right hand side above the output pane. Click it to copy the errors to the clipboard and next paste them here in a reply.

Instructions above are for the normal IDE and might not apply to IDE 2.0 beta.

I have IDE 2.0 beta and an Arduino UNO. The error returned is:

Compilation error: Error: 2 UNKNOWN: exit status 1

I just tried the blink code. It worked just fine.

Copy the FULL error!

Also servo.write uses 0 - 180, not -ve numbers.

Why? It's a beta, not something for beginners but for people that want to test the new IDE

Anyway, to my knowledge, you have to install the servo library; I have no idea how.

If you want to make your life easier, install IDE 1.8.15; you will get normal error messages and the usual libraries are installed.

Compilation error: Error: 2 UNKNOWN: exit status 1

So it's not an upload error and has nothing to do with avrdude and the likes :wink:

Your topic has been moved to a more suitable section of the forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.