Skip to content

Commit db0426d

Browse files
rayozziesteffkelsey
authored andcommitted
Massive updates to init the project for open source
1 parent f1880fa commit db0426d

File tree

12 files changed

+349
-165
lines changed

12 files changed

+349
-165
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/note-c"]
2+
path = src/note-c
3+
url = ../note-c.git

CODE_OF_CONDUCT.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Code of conduct
2+
3+
By participating in this project, you agree to abide by the
4+
[Blues Inc code of conduct][1].
5+
6+
[1]: https://blues.github.io/opensource/code-of-conduct
7+

CONTRIBUTING.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Contributing to blues/note-arduino
2+
3+
We love pull requests from everyone. By participating in this project, you
4+
agree to abide by the Blues Inc [code of conduct].
5+
6+
[code of conduct]: https://blues.github.io/opensource/code-of-conduct
7+
8+
Here are some ways *you* can contribute:
9+
10+
* by using alpha, beta, and prerelease versions
11+
* by reporting bugs
12+
* by suggesting new features
13+
* by writing or editing documentation
14+
* by writing specifications
15+
* by writing code ( **no patch is too small** : fix typos, add comments,
16+
clean up inconsistent whitespace )
17+
* by refactoring code
18+
* by closing [issues][]
19+
* by reviewing patches
20+
21+
[issues]: https://blues.github.com/note-arduino/issues
22+
23+
## Submitting an Issue
24+
25+
* We use the [GitHub issue tracker][issues] to track bugs and features.
26+
* Before submitting a bug report or feature request, check to make sure it
27+
hasn't
28+
already been submitted.
29+
* When submitting a bug report, please include a [Gist][] that includes a stack
30+
trace and any details that may be necessary to reproduce the bug, including
31+
your release version, stack, and operating system. Ideally, a bug report
32+
should include a pull request with failing specs.
33+
34+
[gist]: https://gist.github.com/
35+
36+
## Cleaning up issues
37+
38+
* Issues that have no response from the submitter will be closed after 30 days.
39+
* Issues will be closed once they're assumed to be fixed or answered. If the
40+
maintainer is wrong, it can be opened again.
41+
* If your issue is closed by mistake, please understand and explain the issue.
42+
We will happily reopen the issue.
43+
44+
## Submitting a Pull Request
45+
1. [Fork][fork] the [official repository][repo].
46+
2. [Create a topic branch.][branch]
47+
3. Implement your feature or bug fix.
48+
4. Add, commit, and push your changes.
49+
5. [Submit a pull request.][pr]
50+
51+
## Notes
52+
* Please add tests if you changed code. Contributions without tests won't be
53+
* accepted. If you don't know how to add tests, please put in a PR and leave a
54+
* comment asking for help. We love helping!
55+
56+
[repo]: https://github.com/blues/note-arduino/tree/master
57+
[fork]: https://help.github.com/articles/fork-a-repo/
58+
[branch]:
59+
https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
60+
[pr]: https://help.github.com/articles/creating-a-pull-request-from-a-fork/
61+
62+
Inspired by
63+
https://github.com/thoughtbot/factory_bot/blob/master/CONTRIBUTING.md
64+

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2019 Blues Inc
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19+
OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a library for the Blues Wireless Notecard.

README.txt

-1
This file was deleted.

examples/01-Native-Requests/01-Native-Requests.ino

-24
This file was deleted.

examples/01-Requests/01-Requests.ino

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Copyright 2019 Blues Inc. All rights reserved.
2+
// License <here>.
3+
// (Use Adafruit BMP085 as a good structural example.)
4+
5+
#include <Notecard.h>
6+
7+
// If the Notecard is connected to a Serial port, define it here. If the Notecard is connected using
8+
// the I2C interface, leave this commented out.
9+
//#define serialPort Serial2
10+
11+
// Tell the Notehub which of its accounts manages this device, and configure how often to upload.
12+
void setup() {
13+
14+
// Set up for debug output. If you open Arduino's serial terminal window, you'll be able to
15+
// watch JSON objects being transferred to and from the Notecard for each request.
16+
Serial.begin(115200);
17+
NoteSetDebugOutputPort(&Serial);
18+
19+
// Initialize the physical I/O channel to the Notecard
20+
#ifdef serialPort
21+
serialPort.begin(9600);
22+
NoteInitSerial(&serialPort);
23+
#else
24+
NoteInitI2C();
25+
#endif
26+
27+
// "NoteNewRequest()" uses the bundled "J" json package to allocate a "req", which is a JSON object
28+
// for the request to which we will then add Request arguments.
29+
J *req = NoteNewRequest("service.set");
30+
31+
// This argument causes the data to be delivered to the Personal Project in our notehub.io account.
32+
JAddStringToObject(req, "product", "YOUR_EMAIL_REGISTERED_WITH_NOTEHUB.IO");
33+
34+
// This argument causes the modem to power on and connect continuously to the notehub.io service
35+
JAddStringToObject(req, "mode", "continuous");
36+
37+
// Issue the request, telling the Notecard how and how often to access the service.
38+
// This results in a JSON message to Notecard formatted like:
39+
// { "req" : "service.set",
40+
// "product" : "[email protected]",
41+
// "mode" : "continuous"
42+
// }
43+
NoteRequest(req);
44+
45+
}
46+
47+
// Repeatedly, get some sensor data from the Notecard's own internal sensors, and enqueue
48+
// that data as a new Note within a Notefile that will then be synchronized with the service.
49+
// We can name the JSON fields and the notefile anything we like. We add the ".qo" extension
50+
// to the Notefile name to indicate to the Notecard that this is an "outbound queue" of Notes.
51+
void loop() {
52+
static unsigned messagesSent = 0;
53+
double temperature, voltage;
54+
55+
// Use the temperature sensor on the Notecard to get a sample temperature measurement
56+
// This results in a JSON message to Notecard formatted like:
57+
// { "req" : "card.temp" }
58+
NoteGetTemperature(&temperature);
59+
60+
// Use the voltage ADC on the Notecard to get a sample voltage measurement
61+
// This results in a JSON message to Notecard formatted like:
62+
// { "req" : "card.voltage" }
63+
NoteGetVoltage(&voltage);
64+
65+
// Enqueue the measurement to the Notecard for transmission to the Notehub, indicating that
66+
// this is "urgent" so that the data synchronizes immediately rather than being deferred.
67+
// This results in a JSON message to Notecard formatted like:
68+
// { "req" : "note.add",
69+
// "file" : "sensors.qo",
70+
// "body" : { "temperature" : "<temperature value>",
71+
// "voltage" : "<voltage value>",
72+
// "count" : "<message number>"
73+
// },
74+
// "start" : true
75+
// }
76+
J *body = JCreateObject();
77+
JAddNumberToObject(body, "temperature", temperature);
78+
JAddNumberToObject(body, "voltage", voltage);
79+
JAddNumberToObject(body, "count", ++messagesSent);
80+
NoteSend("sensors.qo", body, true);
81+
82+
// Delay between measurements
83+
delay(15000);
84+
85+
}

examples/02-JSON-Requests/02-JSON-Requests.ino

-56
This file was deleted.

0 commit comments

Comments
 (0)