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)];
 
}

Bildschirmfoto 2009-10-21 um 21.58.01

Sourcecode of the Arduino Socket Server

Sourcecode of the Cocoa Socket Client

Sourcecode of ’simple’ pong

led matrix protocol:

SET LED x:y:color

Related posts:

  1. Arduino LED Matrix Controlling by iPhone Today i ported the mac ArduinoControll app to my iPhone....
  2. Arduino LED Matrix Control Part II With the Arduino app you can control a led...

Ähnliche Artikel bereitgestellt von Yet Another Related Posts Plugin.

2 Comments

GregEigstiOktober 18th, 2009 at 9:49 pm

Nice job!

jhmckeeverJuni 23rd, 2010 at 8:30 pm

Great work. How do you avoid the situation where sending colour 0×25 (‘%’) causes the matrix to go into ‘command’ mode?

Leave a comment

Your comment