marcoschwartz / aREST

A RESTful environment for Arduino
http://aREST.io/
Other
1.2k stars 279 forks source link

How can send 3 parameter for controling RGB Led? Enhancement #275

Open OmiD-K opened 4 years ago

OmiD-K commented 4 years ago
areyalp commented 4 years ago

This can already be achieved.

First declare #define AREST_PARAMS_MODE 1 before importing the arest library.

Then pass the RGB values as parameters in the GET request, e.g: http://192.168.0.10/RGBfunction?red=value1&green=value2&blue=value3

In the setup function you need to register a function with the command: rest.function("RGBfunction",RGBledControl);

Finally you need to declare the function where you would implement the logic: int RGBledControl(String params){}

Inside this function you need to split the params variable for obtaining each param value.

Hope it helps.

OmiD-K commented 4 years ago

Thank you so much can you help me how ? Inside this function you need to split the params variable for obtaining each param value. please write simple sample.

On Sun, Apr 12, 2020 at 8:16 PM areyalp notifications@github.com wrote:

This can already be achieved.

First declare

define AREST_PARAMS_MODE 0

before importing the arest library.

Then pass the RGB values as parameters in the GET request, e.g: http://192.168.0.10/RGBfunction?red=value1&green=value2&blue=value3

In the setup function you need to register a function with the command: rest.function("RGBfunction",RGBledControl);

Finally you need to declare the function where you would implement the logic: int RGBledControl(String params){}

Inside this function you need to split the params variable for obtaining each param value.

Hope it helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marcoschwartz/aREST/issues/275#issuecomment-612635962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZBLNJTE2GDG64CCRL5YJTRMHO5JANCNFSM4KG67J2A .

OmiD-K commented 4 years ago

Hello Marco

On Monday, April 27, 2020, Omid Kazemi ozkazemi@gmail.com wrote: Hi Marco . plz write a sample sketch that describe this . I wrote some sketch but dosent work.

Thank you so much can you help me how ? Inside this function you need to split the params variable for obtaining each param value. please write simple sample.

On Sun, Apr 12, 2020 at 8:16 PM areyalp notifications@github.com wrote:

This can already be achieved.

First declare

define AREST_PARAMS_MODE 0

before importing the arest library.

Then pass the RGB values as parameters in the GET request, e.g: http://192.168.0.10/RGBfunction?red=value1&green=value2&blue=value3

In the setup function you need to register a function with the command: rest.function("RGBfunction",RGBledControl);

Finally you need to declare the function where you would implement the logic: int RGBledControl(String params){}

Inside this function you need to split the params variable for obtaining each param value.

Hope it helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marcoschwartz/aREST/issues/275#issuecomment-612635962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZBLNJTE2GDG64CCRL5YJTRMHO5JANCNFSM4KG67J2A .

ralbright-wa commented 2 years ago

Did you ever get this working as described?