Sensorian
1.0
C API Reference Guide Library
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
main.c
Go to the documentation of this file.
1
/****************************************************************************
2
* Copyright (C) 2015 Sensorian
3
* *
4
* This file is part of Sensorian. *
5
* *
6
* Sensorian is free software: you can redistribute it and/or modify it *
7
* under the terms of the GNU Lesser General Public License as published *
8
* by the Free Software Foundation, either version 3 of the License, or *
9
* (at your option) any later version. *
10
* *
11
* Sensorian is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Lesser General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU Lesser General Public *
17
* License along with Sensorian. *
18
* If not, see <http://www.gnu.org/licenses/>. *
19
****************************************************************************/
20
29
#include <stdio.h>
30
#include <stdlib.h>
31
#include "
Serial.h
"
32
33
int
main
(
int
argc,
char
* argv[])
34
{
35
unsigned
int
ser =
SerialOpen
(115200);
//Open serial port with a 115200 baud rate
36
SerialFlush
(ser);
//Clear TX and RX buffers
37
38
SerialPuts
(ser,
"Serial communication over using the Sensorian Shield.\r\n"
);
39
SerialPrintf
(ser,
"You are using device number %d.\r\n"
,ser);
40
41
SerialPrintf
(ser,
"Closing serial port ..."
);
42
SerialClose
(ser);
//Close serial port
43
44
return
0;
45
}
46
SerialPuts
void SerialPuts(int fd, char *s)
Send a string to the serial port.
Definition:
Serial.c:157
SerialOpen
int SerialOpen(int baud)
Open and initialise the serial port with a specific baud rate.
Definition:
Serial.c:51
SerialClose
void SerialClose(int fd)
Closes the serial port characterized by device number fd.
Definition:
Serial.c:135
Serial.h
Serial port driver header.
SerialPrintf
void SerialPrintf(int fd, char const *message,...)
Printf over Serial Port.
Definition:
Serial.c:168
main
int main(int argc, char **argv)
Definition:
main.c:34
SerialFlush
void SerialFlush(int fd)
Flush the serial buffers (both tx & rx)
Definition:
Serial.c:125
FT230
Example1
main.c
Generated on Sun Jul 12 2015 20:25:27 for Sensorian by
1.8.9.1