Arduino-Yun Wifi - Internet Commands?


hello-

i've got standard push button program connected no relay closes when 'button' pushed, thereby connecting arduino's 5v pin pin #3.

this standard button program monitors #3 pin state.

on arduino yun wifi shield connected lan.  because of yun shield setup, don't have easy method of monitoring shield via serial monitor (nor think need one).  want though insert appropriate programming commands send call api @ internet site (if/when button pushed , pin state = high).  here instructions (from internet site) how send call appropriately i'll notified website:


pushingbox api simple, launch scenario of notifications can send http request or email. argument should attach deviceid. unique key identify scenario want launch. deviceid can found on scenario page.
 you can put more arguments define customs notifications text using own variables.

http api

using command line in terminal

get method curl "http://api.pushingbox.com/pushingbox?devid=v0123456789abcde"

post method curl -d "devid=v0123456789abcde" http://api.pushingbox.com/pushingbox

with php
$ch = curl_init('http://api.pushingbox.com/pushingbox?devid=v0123456789abcde');
curl_exec ($ch);
curl_close ($ch);


can assist me inserting language in void loop (below) such yun shield, connected internet via lan, execute call (above):

void loop() {
  // read state of pushbutton value:
  buttonstate = digitalread(buttonpin);

  // check if pushbutton pressed.
  // if is, buttonstate high:
  if (buttonstate == high) {
    // turn led on:
    digitalwrite(ledpin, high);
  } else {
    // turn led off:
    digitalwrite(ledpin, low);
  }
}

thanks in advance can provide...  i'm thinking post method might effective, i'm not how set up...

take @ bridge library process tutorial.

that example shows using curl command retrieve ascii text file. need change use required command api service.

for example, like:
code: [select]
 process p;          
  p.begin("curl");    
  p.addparameter("-d");
  p.addparameter("\"devid=v0123456789abcde\"");
  p.addparameter("http://api.pushingbox.com/pushingbox");
  p.run();


i did not try compile or run that, may have make changes work, it's starting point. also, mentioned in tutorial, need include process.h , call bridge.begin().

note parameter includes devid string includes quote characters inside string, escaped backslash character. when updating devid string, careful not delete backslash escaping ending quote character.


Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > Arduino-Yun Wifi - Internet Commands?


arduino

Comments

Popular posts from this blog

Valutazione Template - Joomla! Forum - community, help and support

SD Datastring Convention

First use of Arduino Uno : avrdude error on Blink uploading