more G-Labs products

Author Topic: ARDUINO WEB CALLS - GET BACK STATUS  (Read 1504 times)

December 09, 2015, 04:15:15 PM
Read 1504 times

uipipipe

  • *
  • Information
  • Newbie
  • Posts: 11
Hi Everybody,

Like a lot of us, I can control an Arduino from HG using web calls to turn a pin (switch) on, off, just a brief push or a simple toggle, using Ardunino as web server with a ethernet shield.
But I absolutely need to get back the status of those Arduinos's pins, because Arduino is doing is job and in certain conditions it changes de pins status.
I am able to get it status by web (something like http://ipaddress/pin2/status), and the Arduino as web server send back a HIGH or a LOW.

I need help to use this status to turn a HG switch or light signal ON or OFF as soon as some status changes or at least at periodical time lapse.

Can you please help me with this ?
I think with this method we could use an Arduino (cheaper) instead a RPi to send back status to main HG box.

Thanks in advance.

December 09, 2015, 05:16:18 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
You'd simply need to parse the feedback and set the status of the associated module.  What part are you having issues with?  If you can program the Arduino for what you need, send the command from HG, and see the feedback on the HG box, it seems like you are capable of programming the last little bit.  Perhaps I'm misunderstanding the request.

December 09, 2015, 05:51:46 PM
Reply #2

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Look at the arduino "web server" example (https://www.arduino.cc/en/Tutorial/WebServer).  It generates/sends a web page by default with embedded data from the a2d/gpio.  I changed it to send JSON formatted data since HG (or is it C#) parses it effortlessly. 

I am still polling my arduinos for status.  Eventually need to have the arduinos call an HG web api, but I have had trouble making that work.

December 10, 2015, 05:12:56 PM
Reply #3

uipipipe

  • *
  • Information
  • Newbie
  • Posts: 11
@kevin1,

Thank you so much. In fact i just needed that little push. It's done already. Control Arduino input and output digital and analogic pins (feed and feedback).
YoulessEnergy.hgx is a simple and great example

@bkenobi,
Thanks for wake me up from my laziness.  :D :D , I mean it man! Tx. Was realy easy. You were right.

December 11, 2015, 12:00:41 AM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
We all need a little push sometimes.   8)

December 11, 2015, 01:31:28 PM
Reply #5

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Welcome  :)

Some parts of HG are awesome!  I have really enjoyed getting the arduino to HG communications and setting them up in my garage and basement.  Other things in HG have been more difficult, we just need a little bigger community to help everyone out.