Skip to content

A rust program that polls the GPIO of your choice for button press. Once a button is pressed the program outputs text and executes a local program of your choice. Can be done on a raspberry pi.

License

Notifications You must be signed in to change notification settings

zachforrest/gpiotacticalbutton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gpiotacticalbutton

A rust program that polls a GPIO button for button press. Once the button is pressed it will output text and execute a local program of your choice. This program is preconfigured to execute the pushtotext rust program that sends a text message.

Getting Started: (using linux commands)

INSTALL RUST;

CREATE YOUR RUST PROJECTS FOLDER;

  • Create a new folder for your awesome rust projects; mkdir projects
  • Change directory to your projects folder; cd projects
  • (optional) make sure you are in the right folder; pwd

CREATE YOUR RUST PROJECT;

  • Create a new rust application by running; cargo new APPLICATION_NAME
  • Change directory to your new project; cd APPLICATION_NAME

UPDATE THE PROJECT WITH YOUR INFO;

  • Replace the main.rs and toml file dependencies with the ones in this repository.

RUN THE CODE;

  • From terminal run the following command with pin being the pin number your want to poll; cargo run *pin*

SEE IF IT WORKS;

You should see the program start and print aline saying the button is set to "High". When you press the button the terminal will print a line saying "Low" which indicates the button was pressed. If you have placed the pre-compiled pushtotext code into the same folder then it will run the command to start that program as well.

Big thanks to the Rust-Embedded team https://github.com/rust-embedded Also big thanks to the rust-sysfs-gpio team https://github.com/rust-embedded/rust-sysfs-gpio

About

A rust program that polls the GPIO of your choice for button press. Once a button is pressed the program outputs text and executes a local program of your choice. Can be done on a raspberry pi.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages