16-299: Getting started with the Arduinio Nano and the Elegoo Tumbller robot "as is"


Charging the robot

To charge your battery (the black box at the top of the robot).
Turn the switch on the battery to off.
Plug in USB cable that came with robot into the battery and a USB outlet.
The green light on the battery (the other end of the side with the switch) should come on.
Wait until the green light turns off or starts blinking (full charge).
Unplug the USB cable from the battery.


Setting up the Arduino Integrated Development Environment (IDE).

Instructions for how to install the Arduino Integrated Development Environment (IDE) on Windows, Mac, and Linux are at this download page. Download the Arduino IDE 2.0.4 (or whatever the latest version is) onto your computer. In the green area on the right you can pick Windows, Linux, or Mac. Helpful info is available. Googling "how to use Arduino" or searching for it on Youtube will get you many tutorials and helpful videos.

On Linux I downloaded the "AppImage 64 bits (X86-64)", copied the file to my home directory, named it "arduino", and made it executable:
cp arduino-ide_2.0.4_Linux_64bit.AppImage ~/arduino
cd ~
chmod a+x arduino

On Linux I can run the arduino software by typing
~/arduino

Running the Arduino IDE (software) at least once before you plug a cable to an Arduino into your computer will set up the right drivers (on Windows and maybe on Macs). Just Quit to kill it (File -> Quit).

On Linux you may need to change permissions on the USB port:

    sudo chmod a+rw /dev/ttyACM0
  

Is your battery charged yet? If not, go do something else until it is.

Throughout what follows, DON'T turn your battery on. The wheels may spin in an annoying way. Put the robot upside down, so even if the wheels spin, it has no effect.

Now connect the Arduino Nano (board says Elegoo on it) on the robot to your computer with the micro USB cable that cable that came with the robot. I will show some pictures of an Arduino that I took out of a robot, so we can see it better. Here is what it looks like plugged in, with a nice red power light that is on.

Run the Arduino IDE again. You should see something like what is below. All Arduino programs have two top level routines. Setup() does initialization, and then loop() runs over and over again until you stop it.

Click on Select Board, and then click on "Select other board and port...".

You should end up looking at a window like this. Your board is an Arduino Nano, and you should pick whatever port the software suggests. If that port doesn't work, start over and try some other port. This is what ports look like in Linux. On Windows they will probably be COMxx.

You may be asked if you want to update stuff, as at the bottom of this screen capture. Just say yes.

Now let's install and run an example program that blinks an LED. File -> Examples -> 01.Basics -> Blink puts the example program Blink in your editing window.

To compile, install the program on your Arduino (upload it to the Arduino), and run it, press the right arrow button

Your editing window will update:

The green LED will start to blink.

Congratulations, you have run your first Arduino program!

Now try changing the program to make it blink faster. Replace both occurences of delay(1000) with delay(100). Press the right arrow button to compile and download. The green LED should blink faster.

Save the program (File -> Save As) before you exit. Choose a cute pet name for your program that isn't Blink (like my-blinky). Then exit. (File -> Quit).

The default is for your program with the cute pet name to end up in a directory/folder Arduino. Check it out.


Another way to set your board and port is in the Tools menu. That setting may persist across sessions of the other one you did doesn't (what seemed to happen to me).

Here are images of my Arduino preferences menu: