raslib logo

raslib

Manage a Raspberry Pi device from Rust. GPIO ports and L298N motors controller

All tests are performed on Raspberry PI 4B+ on Raspbian OS.

Overview

Install

In your "Cargo.toml" file : toml [dependencies] raslib = "*" Check the current version on crates.io.

Examples

Server socket

Modified from the Rust docs example: ```rust use std::io::prelude::*; use std::net::TcpListener; use std::net::TcpStream;

fn server() { let server = TcpListener::bind(":9000").unwrap();

for stream in server.incoming() {
    let mut stream: TcpStream = stream.unwrap();

    let mut signal = [0; 1];
    loop {
        stream.read(&mut signal); 
        if signal[0] == 0 {
            break;
        }

        // does things with the raspi
    }
}

} ```