ModmataC  1.0
A C library for Arduino communication
button.c
#include <ModmataC.h>
int main() {
connectArduino("/dev/ttyACM0", 115200, 1);
int value = -1;
int led_state = LOW;
while(1) {
value = digitalRead(7);
if(value && !led_state) {
led_state = HIGH;
}
else if(!value && led_state) {
led_state = LOW;
}
printf("%i\n", value);
}
}
int connectArduino(char *port, int baudRate, int id)
Definition: ModmataC.c:93
int digitalRead(uint8_t pinNum)
Definition: ModmataC.c:161
void pinMode(uint8_t pinNum, uint8_t mode)
Definition: ModmataC.c:121
void digitalWrite(uint8_t pinNum, uint8_t input)
Definition: ModmataC.c:143
#define INPUT
Definition: ModmataC.h:39
#define HIGH
Definition: ModmataC.h:43
#define OUTPUT
Definition: ModmataC.h:40
#define LOW
Definition: ModmataC.h:42