Motor drive: Difference between revisions

From Rsewiki
Line 65: Line 65:
so all USB-host joystick support has gone.
so all USB-host joystick support has gone.


OK for this project.
No joystick is OK for this project.
 
The code compiles but does not run!
The same code runs fine when compiled on a normal Ubuntu.

Revision as of 21:33, 18 April 2024

Back to scorpi

Load arduino and Teensyduino

Install Arduino version 1.8.19 for the platform, find it here https://www.arduino.cc/en/software

Unpack in the Downloads directory (to fit the path in the Makefile)

cd ~/Downloads
tar -xf arduino-1.8.19-linuxaarch64.tar.xz

Install Teensyduino from https://www.pjrc.com/teensy/td_download.html

Make the installer executable and install it on top of the Arduino installation.

chmod +x TeensyduinoInstall.linuxaarch64
./TeensyduinoInstall.linuxaarch64

Additional Arduino libraries

Additional libraries from Ardufruit are needed for the small display:

  • Adafruit_BusIO to get additional services from the I2C interface
  • Adafruit-GFX-Library to get the paint functions for the display
  • Adafruit_SSD1306 to get the specifics for the used display
git clone https://github.com/adafruit/Adafruit_BusIO.git
git clone https://github.com/adafruit/Adafruit_SSD1306.git
git clone https://github.com/adafruit/Adafruit-GFX-Library
git clone https://github.com/pfeerick/elapsedMillis.git

The obtained libraries should be included in the Arduino/Teensyduino library list, e.g. if the GIT repositories are in a ~/git directory:

cd Arduino-1.8.19/hardware/teensy/avr/libraries
ln -s ~/git/Adafruit_BusIO
ln -s ~/git/Adafruit-GFX-Library
ln -s ~/git/Adafruit_SSD1306
ln -s ~/git/elapsedMillis

Compile and upload

Compile and upload to Teensy

cd ~/scorpi/motor_drive
make

This should produce a file called motor_drive.hex ready to be uploaded:

NB! before you upload, press the power reset button, to avoid power shutdown.

Press had hold "power reset"
make upload
Release "power reset" when "alive" LED starts blinking

Raspberry 5

Compiling motor drive on the Raspberry 5 failed in one of the Teensy libraries.

This was fixed by renaming a few files in the library:

cd ~/Downloads/arduino-1.8.19/hardware/teensy/avr/libraries/USBHost_t36/
mv BluetoothConnection.cpp BluetoothConnection.cpp.not  
mv bluetooth.cpp bluetooth.cpp.not
mv joystick.cpp joystick.cpp.not

It was probably in the Bluetooth part, but I failed to remove Bluetooth from joystick.cpp, so all USB-host joystick support has gone.

No joystick is OK for this project.

The code compiles but does not run! The same code runs fine when compiled on a normal Ubuntu.