Introduction: Control an LED With Your IPhone
In this Instructable, I will show you how to make your own app using Xcode on your Mac computer and then how to use the app to control an LED through an arduino.
Step 1: Materials
Arduino Uno Board
Arduino Ethernet Shield
LED
200 ohm Resistor
Hook up wires (if needed)
Bread board
iPhone with iOS 9 or later
Mac PC with Arduino Program and Xcode
USB Plugin
Rj-45 Cable (Ethernet Chord)
Step 2: Arduino Program
Follow this link to get to the arduino website to download the program if you do not already have it.
https://www.arduino.cc/en/Main/Software
Select the one for Mac OS X
Step 3: Arduino Code
Step 4: Xcode Coding
First Image is ViewController.m file
Second image is ViewController.h file
Third image is App Preview
Step 5: Testing and Simulation
First, run a test on one of the devices shown in image 1
If the simulation works, plug in your iPhone into your computer and select your device as shown in image 2.
Press the triangle or "play" button on the top right of your screen to run a test/simulation
(NOTE: During first simulation, it may take awhile for the simulation to load)
Step 6: Hooking Up the Arduino and Ethernet Shield
In the Arduino website, you will get an image like the one shown. You will plug in the USB chord into your computer and the other end into the arduino. The Rj-45 cable will plug in to your ethernet shield and wireless wifi router. Then, the first two buttons on the Arduino page like the image shown is what you need to press, "Verify and Upload" press Verify first, and once it is verified, press upload. You should get a message at the bottom of the page saying uploaded to board.
Step 7: Hooking Up Arduino and LED
Make sure the LED side that is closer to the resistor is the shorter (negative) side and the wire leading from the LED is plugged into the Digital Pin 2 and the wire from the resistor is plugged into the Digital Ground Pin (GND).
Step 8: Finish
Hook up the Arduino and Ethernet Shield like the image and make sure your app is on your phone, and your code for Arduino is uploaded to the board. Run your app, and flip the switch and the LED should turn on