ModmataC
1.0
A C library for Arduino communication
|
#include "ModmataC.h"
Functions | |
void | closeConnection () |
void | delay (int millis) |
void | delayMicroseconds (int micros) |
int | isValidPin (int pinNum) |
int | connectArduino (char *port, int baudRate, int id) |
void | pinMode (uint8_t pinNum, uint8_t mode) |
void | digitalWrite (uint8_t pinNum, uint8_t input) |
int | digitalRead (uint8_t pinNum) |
void | analogWrite (uint8_t pinNum, uint16_t input) |
int | analogRead (uint16_t pinNum) |
void | servoAttach (uint16_t pinNum) |
void | servoDetach (uint16_t pinNum) |
void | servoWrite (uint16_t pinNum, uint16_t input) |
int | servoRead (uint16_t pinNum) |
void | wireBegin () |
void | wireEnd () |
void | wireSetClock (uint32_t clock_speed) |
void | wireWrite (uint8_t addr, uint8_t reg, uint8_t num_bytes, uint8_t *data) |
uint8_t * | wireRead (uint8_t addr, uint8_t reg, int num_bytes) |
void | spiBegin () |
uint8_t * | spiTransferBuf (int CS_pin, uint8_t *buf, uint8_t length) |
void | spiSettings (uint32_t speed, uint8_t order, uint8_t mode) |
void | spiEnd () |
void | transmitRegisters (uint8_t fn_code, uint8_t argc, uint8_t *argv) |
int analogRead | ( | uint16_t | pinNum | ) |
Reads the value of an analog pin
(uint8_t) | address |
(uint8_t) | register |
(uint8_t) | number of bytes to read |
void analogWrite | ( | uint8_t | pinNum, |
uint16_t | input | ||
) |
Writes an analog value to a pin
(uint8_t) | pin number |
(uint16_t) | value to write |
void closeConnection | ( | ) |
disconnect modbus connection if the program does not have an infinite loop
none |
int connectArduino | ( | char * | port, |
int | baudRate, | ||
int | id | ||
) |
Start serial connection using specified port and baud rate
(char*) | path to the port on which Leonardo is connected |
(int) | baud rate |
(int) | slave id for Leonardo |
void delay | ( | int | millis | ) |
Causes the system to delay a number of miliseconds
(int) | milliseconds |
void delayMicroseconds | ( | int | micros | ) |
int digitalRead | ( | uint8_t | pinNum | ) |
Reads the value of a digital pin
(uint8_t) | pin number |
void digitalWrite | ( | uint8_t | pinNum, |
uint8_t | input | ||
) |
Writes a HIGH or LOW value to a digital pin
(uint8_t) | pin number |
(uint8_t) | input, should be 1 or 0 |
int isValidPin | ( | int | pinNum | ) |
Checks if a pin number is valid The leonardo has pins 1-30
(int) | pint number |
void pinMode | ( | uint8_t | pinNum, |
uint8_t | mode | ||
) |
Sets pin mode
(uint8_t) | pin number |
(uint8_t) | pin mode |
void servoAttach | ( | uint16_t | pinNum | ) |
Attach servo to a pin
(uint16_t) | pin number |
void servoDetach | ( | uint16_t | pinNum | ) |
int servoRead | ( | uint16_t | pinNum | ) |
Reads the last value written to a servo
(uint16_t) | pin number |
void servoWrite | ( | uint16_t | pinNum, |
uint16_t | input | ||
) |
Write values to a servo assigned pin
(uint16_t) | pin number |
(uint16_t) | angle value to be written |
void spiBegin | ( | ) |
Begins SPI communication with default settings (4 Mbps, MSBFIRST, SPI_MODE0)
void spiEnd | ( | ) |
End SPI communication
void spiSettings | ( | uint32_t | speed, |
uint8_t | order, | ||
uint8_t | mode | ||
) |
Set specific SPI settings such as communication speed, bit order, and mode
(uint32_t) | Communication speed |
(uint8_t) | bit order (MSBFIRST or LSBFIRST) |
(uint8_t) | data mode (SPI_MODE0, SPI_MODE1, SPI_MODE2, or SPI_MODE3) |
uint8_t* spiTransferBuf | ( | int | CS_pin, |
uint8_t * | buf, | ||
uint8_t | length | ||
) |
Transfer an array of bytes over SPI
(int) | Chip Select pin number |
(uint8_t*) | Array of bytes to transfer over MOSI |
(uint8_t) | Array length |
void transmitRegisters | ( | uint8_t | fn_code, |
uint8_t | argc, | ||
uint8_t * | argv | ||
) |
void wireBegin | ( | ) |
void wireEnd | ( | ) |
Terminates an I2C connection
uint8_t* wireRead | ( | uint8_t | addr, |
uint8_t | reg, | ||
int | num_bytes | ||
) |
Reads data from an I2C connection
(uint8_t) | address |
(uint8_t) | register |
(uint8_t) | number of bytes to read |
void wireSetClock | ( | uint32_t | clock_speed | ) |
Sets I2C clock speed
(int) | clock speed |
void wireWrite | ( | uint8_t | addr, |
uint8_t | reg, | ||
uint8_t | num_bytes, | ||
uint8_t * | data | ||
) |
Writes data over an I2C connection
(uint8_t) | address |
(uint8_t) | register |
(uint8_t) | number of bytes to be written |
(uint8_t) | data being written |