❖ Xcode, Swift 3
❖ Arduino IDE
Application Programming: Fun with iPhones
I thought for a long time of how I want to interface with my wireless module, and while I had enjoyed ("enjoyed") the process of milling, soldering, and debugging a wireless board from scratch, and thus considered options such as radio or bluetooth to interface, I would try something different:
The idea came to me while thinking about not only how to communicate with my wireless module, but also what type of information I could send to the server for interfacing. Unlike all the wireless firmware shenanigans I had to deal with, I decided that not only would trying to develop a mobile app be a more well documented method to tackle my project, using a phone would also allow me to take advantage of data only an advanced mobile device could collect (location, accelerometer, etc.).
For the purposes of this week, I wanted to just write a basic application that would successfully send data from my phone to the ThingSpeak server to the wireless module. The first annoying obstacle I encountered was that while I owned an iPhone, I only had a windows computer - Apple doesn't allow development for iOS applications outside of their own devices (or hackintoshes etc) - thanks to Rob I was able to borrow a MacBook from the Harvard Lab and begin my first foray into Xcode, the application used for app development.
Since 2014 Apple has allowed developers to choose between Swift or Objective-C to build their applications, and I built my application using the Swift development language. Since I had little experience developing mobile apps, I made sure to spend plenty of time watching online tutorials. My app ended up being very straightforward to develop, using simple buttons and HTTP POST requests to send information up into the cloud.
My app simply had 3 buttons for Red, Green, and Blue, and the ESP8266 would read inputs from the webserver to change it's LED accordingly. Note that the ThingSpeak server would only allow free users to send 1 request every 15 seconds, which is why I had to pause in my video before changing the light color: