How do I add a sketch

I'm using the Arduino to set up a pir, a servo motor and some LEDs but the sketch for the PIR isn't in the Sketch folder but on my desktop in notepad.
I don't know how to add the PIR sketch to the Arduino IDE.

Perhaps some one could explain this in easy terms as I'm 80 and still trying to get to grips with Arduino.

Thanks a lot.

Michael

  • launch the IDE
  • open a new sketch and remove what's in that window (it should be all blank)
  • copy and paste the code from notepad into the newly created sketch window
  • select the board to match your arduino
  • select the Serial port to match where your arduino is connected
  • press the right arrow button at the top of the IDE window to compile and upload the code

You can also read https://www.arduino.cc/en/Guide

  1. Save the file to ANYNAME.INO
  2. Double-click ANYNAME.INO.
  3. When the IDE asks "create a folder?" click "OK"
  4. Move the folder into your SKETCHES folder.
    any

Thanks a lot lads. I followed your instructions and it all worked perfectly. The red LED is coming on for a set time whenever I cross my hand in front of the PIR and then switching off again. I'm quite hooked on waving my hand in front of it as it gives me a sense of satisfaction thinking, "I built this". You know what I mean.
Now I have to figure out how to incorperate a Micro servo and a set of 4 LEDs into the Arduino so when I wave my hand, the servo rotates and the LEDs come on for the same time duration as the single Red LED. I can't use a breadboard as there is a space shortage where I'm going to put this setup.

Anyway thanks again to both of you for your imput.

Michael.

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