Arduino Control using Communication Bridge
hi !!
this first post in forum.
i want introduce program called "arduinowing" developed implit co., ltd. arduinowing kind of communication bridge program arduino..
the pc running arduinowing act kind of restful api server of kvt(key value table) announced arduino sketch.. pc , arduino connected usb cable same cable used upload sketch arduino board.
aruidnowing provides restful api service of key/value pair of data(kvt) announced arduino sketch (with simple arduinowing api function). , provides control mechanism arduino sketch callback function key/value pair parameter.
it can implemented control , view data of arduino adding arduinowing api existing arduino sketch.
following simple example how monitor temperature , humidity value , control led of arduino using internet browser.
1. download attached arduinowing sketch source
void put(string key, string value)
announce key/value arduinowing, key/value pair can shown using restful api(also can see key/value using internet browser)
void loop()
arduinowing heart beat function, function must called periodically.
3. download arduinowing program
download link here windows, osx, linux
4. excute arduinowing
5. next, type http port use connect http server. if want http authorization, type id, pw. select arduino port. click start
6. connect http://[your ip]:[port] using internet browser arduinowing.
7. key list
this menu can view list of keys announced arduino sketch using "put" function of arduinowing
8. key value
this menu can view value of selected key item, can select last value or value history.
9. menu provides arduino sketch control mechanism. when click "send" button, arduinowing callback function invoked key/value specified.
in example, select led, set value 0 , click send, see turn off led.
the context of "serial.print" function display on arduinowing application's log window.
arduinowing use same usb serial port arduino ide. so, when arduinowing started, usb serial port under control of arduinowing. use arduino ide upload sketch, must stop arduinowing.
also, can arduinowing client application android here [download link] or search "arduinowing" in google play store
this first post in forum.
i want introduce program called "arduinowing" developed implit co., ltd. arduinowing kind of communication bridge program arduino..
the pc running arduinowing act kind of restful api server of kvt(key value table) announced arduino sketch.. pc , arduino connected usb cable same cable used upload sketch arduino board.
aruidnowing provides restful api service of key/value pair of data(kvt) announced arduino sketch (with simple arduinowing api function). , provides control mechanism arduino sketch callback function key/value pair parameter.
it can implemented control , view data of arduino adding arduinowing api existing arduino sketch.
following simple example how monitor temperature , humidity value , control led of arduino using internet browser.
1. download attached arduinowing sketch source
quote
#include <dht.h>2. import arduinowing library , compile above sketch
#include <arduinowing.h>
dht dht;
#define dht11_pin 2
#define led_pin 8
// pass callback function
arduinowing arduinowing(callback);
void setup()
{
serial.begin(9600);
serial.println("begin...........");
pinmode (led_pin, output);
}
string humidity;
string temperature;
void loop()
{
serial.println("loop...........");
int chk = dht.read11(dht11_pin); // read data
switch (chk)
{
case dhtlib_ok:
serial.println("ok");
/*
send key/value pair using put function,
you can view key/value pair through restful api
*/
humidity = string(dht.humidity);
serial.println("temperature\t" + humidity);
arduinowing.put("humidity", humidity);
temperature = string(dht.temperature);
serial.println("temperature\t" + temperature);
arduinowing.put("temperature", temperature);
break;
case dhtlib_error_checksum:
serial.println("checksum error,\t");
break;
case dhtlib_error_timeout:
serial.println("time out error,\t");
break;
default:
serial.println("unknown error,\t");
break;
}
arduinowing.loop(); // receive control request
delay(1000);
}
/*
this callback function called when arduinowing accepts control request.
in example, if key led , value 0, turn off led
or turn on led
*/
void callback(char *key, char *value)
{
if (strcmp(key, "led") == 0)
{
digitalwrite(led_pin,strcmp(value, "0") == 0 ? low : high);
serial.print("led\t" + string(value));
arduinowing.put("led", value);
}
else
{
// not defined key
}
}
void put(string key, string value)
announce key/value arduinowing, key/value pair can shown using restful api(also can see key/value using internet browser)
void loop()
arduinowing heart beat function, function must called periodically.
3. download arduinowing program
download link here windows, osx, linux
4. excute arduinowing
5. next, type http port use connect http server. if want http authorization, type id, pw. select arduino port. click start
6. connect http://[your ip]:[port] using internet browser arduinowing.
7. key list
this menu can view list of keys announced arduino sketch using "put" function of arduinowing
8. key value
this menu can view value of selected key item, can select last value or value history.
9. menu provides arduino sketch control mechanism. when click "send" button, arduinowing callback function invoked key/value specified.
in example, select led, set value 0 , click send, see turn off led.
the context of "serial.print" function display on arduinowing application's log window.
arduinowing use same usb serial port arduino ide. so, when arduinowing started, usb serial port under control of arduinowing. use arduino ide upload sketch, must stop arduinowing.
also, can arduinowing client application android here [download link] or search "arduinowing" in google play store
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Arduino Control using Communication Bridge
arduino
Comments
Post a Comment