Jump to content
Daniel Freire

ARDUINO UNO R3 + CuHead Wifi Shield

Recommended Posts

Good Nigth all,

 

I am developing a project with the ARDUINO UNO R3 together CuHead Wifi Shield V2.  I am having difficulty to how to use the correct functions to read datas via Socket Application from my Mobile Android App. I have been successfully run the exemplo code SocketApp.h downloaded together WiShield Library following this link -> https://github.com/linksprite/ZG2100BasedWiFiShield . But I don`t know how to manipulate the functions inside the psock.h file. I believe that I have to use the PSOCK_READBUF() function, but I need help to use it. 
In practice I need that the Arduino implements this simply function: After received the data, string data, from my Android SocketApp, it can uses a IF condition, IF(Data) make do (Liga Led) . So, I need to know manipulate any function to read this data.

Please anybody can help me? If possible please send me a exemplo code to manipulate this function or bufer :D

 

Remark: After downloaded the WiShield Library that above link, it is necessary to unzip library inside the ARDUINO Libraries folder created at the time of installation ARDUINO. Exemplo: C:\Program Files (x86)\Arduino\libraries and after this you can open socket exemplo code in ARDUINO IDE as bellow:

Click in File>Exemples>WishieldLibrarie>SocketApp

 

 

Following below the part code that handle connection in SocketApp exemplo code.

All socket functions is inside the psock.h file. 

 

static int handle_connection(struct socket_app_state *s)
{
  PSOCK_BEGIN(&s->p);
 
  PSOCK_SEND_STR(&s->p, "Hello. What is you name?\n");
  PSOCK_READTO(&s->p, '\n');
  PSOCK_SEND_STR(&s->p, "Hello ");
  
  PSOCK_SEND_STR(&s->p, s->inputbuffer);
  memset(s->inputbuffer, 0x00, sizeof(s->inputbuffer));
  PSOCK_CLOSE(&s->p);
 
  PSOCK_END(&s->p);
}

 

 

ZG2100BasedWiFiShield-master.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×