2) Please charge the battery on the robot fully. This makes the battery happier.
3) We need to get the programming environment (Integrated Development Environment (IDE)) from Arduino, which runs on your computer. Download the Arduino IDE 2.3.2 (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.
4) We are using the Nano Every board, which uses an ATmega4809 chip, which is not the default in the IDE. We need to load information about the MegaAVR boards once from the board library.
4a) After installing the Arduino software, trying running it with the
Arduino on the robot connected to your computer with the USB
cable that comes
with the robot. (Type arduino to a command line in linux, or just click
on the Arduino icon in all OSes) You may get prompted to load MegaAVR software (See the "Install this package to use your Arduino Nano Every board" line
at the bottom of this screen capture).
Go ahead
and do that.
You should see
something like the screen capture below, with the Nano Every listed. Press on the install button. Let it finish installing.
Then kill that menu and go to step 5 (you could click on File and then Quit to restart the
Arduino IDE).
4b) If you don't get prompted to load the MegaAVR software, you have to
do it manually.
Select "Tools", "Board", and then "Board Manager". At this point you get the "Boards Manager" menu. Select "Arduino megaAVR Boards". You should see
something like the screen capture above, with the Nano Every listed. Press on the install button. Let it finish installing.
Then kill that menu (you could click on File and then Quit to restart the
Arduino IDE).
5) Now we tell the IDE which board we are actually using.
Select "Tools", "Board", "Arduino megaAVR Boards",
and then "Arduino Nano Every"
6) Now we tell the IDE to take advantage of the new ATmega4809 features.
Select "Tools", "Registers Emulation", and then "None (ATMEGA4809)".
7) If you haven't already done so, plug the USB cable that came with the robot to connect the Nano Every USB micro connector to a USB port on your computer.
On Linux this should create a /dev/ttyUSB0 or /dev/ttyACM0 port. On Windows
this should create a COM port, which you can examine with the Device Manager program. I don't know how Macs work.
8) Select "Tools", "Port", and then one of the ports offered to you in a popup
menu. Ideally one of them says "Nano Every", but if not you may have to
do some detective work or just try them one by one.
9) Here is what my "Tools" menu looks like when i am done (on linux):
10) When you powered up the Nano Every (by plugging in the USB cable or
the battery), the yellow/orange LED starts blinking every
second (1 second on, one second off, ...). The "Blink" example program is
preloaded.
11) To test things, you can change and then run the "Blink" program: Select "File", "Examples", "01 Basics", and then "Blink", and a new IDE window will appear. Change the 1000s to 200s.
Click on
the right arrow button, and that program will be downloaded into the
Arduino computer. Soon the yellow/orange LED on the Nano Every
should turn on and off faster (1/5 second on, 1/5 second off, ...)
12) On linux you may have to change the permissions on the device file
for the tty device (in my case /dev/ttyACM0) with:
13) Unfortunately, the download process with the Nano Every boards is a little
erratic (the 4809 boards use a different download procedure than normal).
I got "Sketch uses ..." and "Global variables use ..." in regular text,
and then an error message in orange text.
I pressed download again and got a different orange error message.
I pressed download again and got "avrdude: jtagmkII_initialize(): Cannot locate flash and boot memories in description". This means everything is working! The LED starts flashing faster (not the green one, the orangish one).
14) Congratulations, you have run your first Arduino program!
Here are images of my Arduino preferences menu:
sudo chmod a+rw /dev/ttyACM0
or (better) add yourself to the dialout group with:
sudo adduser your-login dialout