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
Related posts:
- Arduino LED Matrix Controlling by iPhone Today i ported the mac ArduinoControll app to my iPhone....
- Arduino LED Matrix Control Part II With the Arduino app you can control a led...
Ä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?