Arduino LED Matrix Controlling by iPhone
Today 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
Related posts:
- Arduino + Wishield + LED Matrix = a lot of fun! socketapp.c extern char buffer[20]; static int handle_connection(struct socket_app_state *s)...
- Arduino LED Matrix Control Part II With the Arduino app you can control a led...
- Arduino iphone Webinterface + Alcohol Sensor Erreichte Ziele Arduino über Webinterface gesteuert (LED an/aus) Alcohol...
- Alcohol Gas Sensor MQ-3 + Arduino Mein selbstgebauter Alkohol Sensor. Der Sensor misst den aktuellen Alkohol...
Ähnliche Artikel bereitgestellt von Yet Another Related Posts Plugin.
Oktober 21st, 2009 in
Arduino | tags: Accelerometer, Arduino, cocoa, iphone, led, matrix, objectiv-c, sparkfun







