Warning: Use of undefined constant DB_CHARSET - assumed 'DB_CHARSET' (this will throw an Error in a future version of PHP) in /home/forge/floriansweb.com/wp-content/plugins/wordpress-flickr-manager/FlickrManager.php on line 109
Arduino LED Matrix Controlling by iPhone | Floriansweb

Arduino LED Matrix Controlling by iPhone

IMG_0099IMG_0100Today i ported the mac ArduinoControll app to my iPhone.

+ now you can controll the LED via the UIAccelerometer

#pragma mark UIAccelerometer delegate
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
 
	double xAcceleration = 100.0 - (acceleration.x + 1.0) * 100.0;
	double yAcceleration = 100.0 - (acceleration.y + 1.0) * 100.0;
	double zAcceleration = 100.0 - (acceleration.z + 1.0) * 100.0;
 
	accelerationX.text = [[NSString alloc] initWithFormat:@"%4.1f%", xAcceleration];
	accelerationY.text = [[NSString alloc] initWithFormat:@"%4.1f%", yAcceleration];
	accelerationZ.text = [[NSString alloc] initWithFormat:@"%4.1f%", zAcceleration];
 
 
	long xValue = map(xAcceleration, -100, 100, 0, 7);
	long yValue = map(yAcceleration, -100, 100, 0, 7);
 
	[positionX setValue:xValue];
	[positionY setValue:yValue];
 
	NSString *command = [NSString stringWithFormat:@"SET LED %d:%d:%d", (int)xValue, (int)yValue, (int)[color value]];
	[socket sendData:command];
 
}

Sourcecode of Arduino Controlling with iPhone

Leave a comment

Your comment