ModmataC  1.0
A C library for Arduino communication
pot.c
#include <ModmataC.h>
int main() {
// start serial connection with arduino, given a port and baud rate
connectArduino("/dev/ttyACM0", 115200, 1);
int value = -1;
int led_val = 0;
while(1) {
value = analogRead(18) / 4;
if(value != led_val) {
led_val = value;
analogWrite(13, led_val);
}
printf("%i\n", value);
}
}
int connectArduino(char *port, int baudRate, int id)
Definition: ModmataC.c:93
void pinMode(uint8_t pinNum, uint8_t mode)
Definition: ModmataC.c:121
int analogRead(uint16_t pinNum)
Definition: ModmataC.c:212
void analogWrite(uint8_t pinNum, uint16_t input)
Definition: ModmataC.c:190
#define OUTPUT
Definition: ModmataC.h:40