GithubHelp home page GithubHelp logo

rusty_servo_intro's Introduction

Making a motor do things with Rust and a Raspberry Pi

This is a simple example mostly lifted directly from the rppal hardware PWM example. I just ran into a few setup issues and wanted to document how I got it working (mostly for when I inevitably forget a step).

hardware setup

Setup Raspberry Pi

Standard setup for rpi is here and works fine for this, except for possibly the error below. Don't bother with the fix unless you're getting the error.

Set up ssh access to the pi (see here for details). I also assigned a static IP to the pi in my router so I could just alias the connect and mount commands, but you could also just look them up each time by running hostname -I on the pi.

If, when running cargo run (or running the built artifact), you're getting Error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }), then try adding the following line to the end of your /boot/config.txt file:

dtoverlay=pwm,pin=18,func=2

(thanks @drauschenbach for the fix here)

Setup sshfs for easy editing of files on the pi

Install sshfs (and fuse if you're on Mac) on your local machine (one tutorial here).

After some experimentation I settled on the following for connecting and mounting the pi (sshfs is a bit flaky, and I found that the reconnect and workaround=all options helped but ymmv):

alias connect_pi="ssh [email protected]"
alias mount_pi="diskutil umount force ~/rpi/; sshfs -C -o reconnect -o workaround=all -o IdentityFile=/path/to/ssh/private/key [email protected]:/home/pi /Users/bws/rpi"

Install Stuff for Cross Compiling

NB: For cross compiling with cross you need Docker running.

# run on your macbook to generate the cross compiled binary for the rpi
# if you're on the rpi you can just run `cargo build`
cargo install cross
cross build --target armv7-unknown-linux-gnueabihf # or specify the target in your .cargo/config

Some resources that I found helpful

rusty_servo_intro's People

Contributors

bwstearns avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.