Skip to content

erdeszt/arduino-serial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Serial communication with Arduino in C

Read a line from Arduino:

#include <termios.h>
#include "serial.h"

int main(int argc, char **argv) {
    int device = serial_open("dev/ttyACM0", B9600);
    char buffer[255];

    serial_read_until(device, buffer, '\n', 255);

    /* The buffer is guaranteed to have a terminating null
     * so it's safe to print right out
     */
    printf("Mesage from Arduino: %s\n", buffer);

    serial_close(device);

    return 0;
}

About

Talking to your arduino with C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages