Arduino + Wishield + LED Matrix = a lot of fun!
socketapp.c
extern char buffer[20]; static int handle_connection(struct socket_app_state *s) { PSOCK_BEGIN(&s->p); PSOCK_READTO(&s->p, '\n'); memcpy(buffer,s->inputbuffer,20); memset(s->inputbuffer, 0x00, sizeof(s->inputbuffer)); PSOCK_END(&s->p); }
main
void loop() { WiFi.run(); if(strncmp(buffer, "SET LED", 7) == 0) { substr(positionX, buffer, 8,1); substr(positionY, buffer, 10,1); substr(color, buffer, 12,3); matrix.set(atoi(positionX),atoi(positionY), atoi(color)); matrix.send(); }
Sending to the socket server (Cocoa, NSStream)
-(void)sendData:(NSString *)string { NSString *stringWithEnding = [NSString stringWithFormat:@"%@\n", string]; const uint8_t * rawstring = (const uint8_t *)[stringWithEnding UTF8String]; [oStream write:rawstring maxLength:strlen(rawstring)]; }
Sourcecode of the Arduino Socket Server
Sourcecode of the Cocoa Socket Client
led matrix protocol:
SET LED x:y:color
No related posts.
Ähnliche Artikel bereitgestellt von Yet Another Related Posts Plugin.









Nice job!
Great work. How do you avoid the situation where sending colour 0×25 (‘%’) causes the matrix to go into ‘command’ mode?
Hi,
Sorry to disturb you!
I use MAC mini to run your code to connect Arduino with WiShield 2.0!
I try both MAC mini to connect router and not connect router.
But there is no connection!
Could you give me some suggestion?Please!
I really need your help.
Any advices will be appreciated!Thanks in advance.
hello, nice project but i don’t arrive to do it, i have this error:
socketapp.c: In function ‘handle_connection’:
socketapp.c:112: error: ‘amp’ undeclared (first use in this function)
can you help me please
I did not understand a thing.
Every time the arduino receives the data and closes the socket. In your application you are connecting when requested and not when it will send the data, then how could you send? Because if you sent one time he closed the socket