All Projects → myfreeweb → Conatra

myfreeweb / Conatra

Licence: unlicense
Sinatra-style syntax for the Internet of Things (CoAP/CoRE, Arduino)

Labels

Projects that are alternatives of or similar to Conatra

Tembooforesp8266
Arduino Library of Temboo modified for ESP8266
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Esp8266 As Arduino Shield Sketches
Sketches for the Arduino (UNO, unless otherwise specified) that interface with the ESP8266 WiFi card to do neat things.
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Pov display
For E190p Embedded Systems
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Stewart Platform Code
Basic functionality for stewart platform with servos
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Unplug
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Proximity Mp3
Bare Conductive MPR121 Proximity-to-MP3 Example Code
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Aaduino
An AA sized ISM radio Arduino clone
Stars: ✭ 816 (+13500%)
Mutual labels:  arduino
Iot Arduino Cookbook
Code for the Internet of Things Cookbook
Stars: ✭ 6 (+0%)
Mutual labels:  arduino
Rallyduino
Automatically exported from code.google.com/p/rallyduino
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Mqtt For Waspmote 3g Module
An MQTT library for Waspmote's 3G Module
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Dolly Slider Bt
Dolly Slider Arduino app
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Arduino Esp8266 Pir
Use Arduino with ESP8266 WiFi module and a PIR sensor
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Blemini sparkcore
Spark Core and BLE Mini in Central Role
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Open Home Automation
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
Stars: ✭ 820 (+13566.67%)
Mutual labels:  arduino
Soundburst
µSoundBurst is a color organ for your embedded projects.
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Frequency Analyzer Arduino
Spectrum Analyzer using Goertzel Algorithm in Arduino (2016)
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Lbscratch
This repository is for anybody who wants to use Scratch with the littleBits system, or help us develop code to do so.
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino
Vitotronic Interface 8266
ESP8266 WiFi to serial interface, built to connect to a Viessmann Vitotronic heating control.
Stars: ✭ 6 (+0%)
Mutual labels:  arduino
Multibitbangpoc
Proof of concept test to see if you can drive 8 WS2812B neopixel strips in parallel
Stars: ✭ 6 (+0%)
Mutual labels:  arduino
Ardusat Experiments
A set of useful experiments that can be run on Ardusat.
Stars: ✭ 5 (-16.67%)
Mutual labels:  arduino

conatra unlicense

A C/C++ library for implementing CoAP / CoRE on microcontrollers, featuring Sinatra-style syntax!

  • CoAP is the Constrained Application Protocol, which is basically simplified and very compact binary HTTP over UDP.
  • CoRE is the Constrained RESTful Environments Link Format, which is basically the HTTP Link header as a response, not as a header.

This allows you to create RESTful interfaces on IoT (Internet of Things) devices.

In the box:

  • <conatra.h> // a Sinatra-style DSL for the microcoap library (using C preprocessor dark magic)
  • <EtherCard+coap.h> // boilerplate for connecting the EtherCard library (driver for the very popular ENC28J60 Ethernet module) with the microcoap library // supports multicast!
  • <WiFi+coap.h> // boilerplate for connecting the Arduino WiFi library (for the WiFi Shield or the ESP8266) with the microcoap library

If you use a different networking module, please send a pull request with boilerplate necessary for supporting it!

Usage

Arduino

  1. Install the microcoap library into the Arduino IDE;
  2. Remove main-posix.c and endpoints.c from the libraries/microcoap folder, because the IDE tries to compile all the things for no good reason;
  3. Install the library for your network module (EtherCard) into the Arduino IDE;
  4. Install conatra into the Arduino IDE;
  5. Use all of that stuff in your sketches like this:
#include <EtherCard.h>
#include <coap.h>
#include <EtherCard+coap.h>

byte Ethernet::buffer[400];
static uint8_t mymac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x31 };

void setup(void) {
  if (ether.begin(sizeof Ethernet::buffer, mymac, 4) == 0)
    Serial.println(F("Ethernet failed"));
  if (!ether.dhcpSetup())
    Serial.println(F("DHCP failed"));
  ether.printIp("My IP: ", ether.myip);
  coap_ethercard_begin();
  coap_ethercard_begin_multicast();
}

void loop(void) {
  ether.packetLoop(ether.packetReceive());
  delay(50);
}

// We define our endpoints in the ROUTES macro using the ROUTE macro:
// ROUTE(name, method, url, CoRE parameters, handler body)
//
// The name is used in C identifiers and doesn't
// really matter, just has to be unique.
//
// If you don't want to list the endpoint in CoRE links:
// ROUTE_HIDDEN(name, method, url, handler body)
//
// For responding, use one of the following macros:
// CONTENT, NOT_FOUND, BAD_REQUEST, CHANGED

#define ROUTES \
ROUTE(hello, COAP_METHOD_GET, URL("tests", "hello"), ";if=\"test\"", { \
  char response[3] = "Hi"; \
  CONTENT(COAP_CONTENTTYPE_TEXT_PLAIN, response); \
})

#include <conatra.h>

Here's how you would interact over this example (using the coap-cli tool):

$ coap get coap://192.168.1.13/.well-known/core
</tests/hello>;if="test"
$ coap get coap://192.168.1.13/tests/hello
Hi

For a full example, see the examples/iotweather/iotweather.ino sketch.

Contributing

Please feel free to submit pull requests! Bugfixes and simple non-breaking improvements will be accepted without any questions :-)

By participating in this project you agree to follow the Contributor Code of Conduct.

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].