Skip to content

Commit f8c8924

Browse files
committed
Add library readme
1 parent fbde7d3 commit f8c8924

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

arduino/README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Arduino Cereal Library
2+
3+
Arduino library for tracking variables in [Cereal monitor ](../).
4+
5+
### Install
6+
7+
Download and manually install to your Arduino libraries. Read *Manual Installation* section on Arduino's [library installation instruction](https://www.arduino.cc/en/Guide/Libraries) page.
8+
9+
### Usage
10+
11+
Cereal monitor supports three different types of variables: *basic* variable, *range* and a *flag* variable.
12+
13+
For basic variable output, use:
14+
```c++
15+
Cereal.varaible(name, value);
16+
```
17+
18+
For range variable outputs use:
19+
```c++
20+
Cereal.range(name, value, from, to);
21+
Cereal.analog(name, value);
22+
```
23+
24+
For flag variable output use:
25+
```c++
26+
Cereal.digital(name, value);
27+
```
28+
29+
### Example
30+
31+
```c++
32+
#include "Cereal.h"
33+
34+
#define STATUS_PIN 3
35+
#define THROTTLE_PIN A2
36+
37+
void setup() {
38+
// Set the baud rate for serial data transmission
39+
Serial.begin(9600);
40+
41+
pinMode(STATUS_PIN, INPUT);
42+
pinMode(THROTTLE_PIN, INPUT);
43+
44+
// Serial output shown in [Monitor] window
45+
Serial.println("Setup done...");
46+
}
47+
48+
void loop() {
49+
int rnd = random(10, 20);
50+
int throttle = analogRead(THROTTLE_PIN);
51+
int status = digitalRead(STATUS_PIN);
52+
53+
// Basic variable type output
54+
Cereal.variable("Random", rnd);
55+
56+
// Range variable type output
57+
Cereal.analog("Throttle", throttle);
58+
59+
// Flag variable type output
60+
Cereal.digital("Status", status);
61+
}
62+
63+
```
64+
65+
Running this examples gives the following output:
66+
67+
![image](../images/demo.gif)

images/demo.gif

136 KB
Loading

0 commit comments

Comments
 (0)