I’m following the tutorial and reference guide to be able to create my own iOS app for the Particle Photon, however I’m facing a small issue.
@IBAction func login(sender: Any) {
SparkCloud.sharedInstance().login(withUser: email, password: password) { (error:Error?) -> Void in
if let _ = error {
print("Wrong credentials or no internet connectivity, please try again")
}
else {
print("Logged in")
var myPhoton : SparkDevice?
SparkCloud.sharedInstance().getDevices { (devices:[SparkDevice]?, error:Error?) -> Void in
if let _ = error {
print("Check your internet connectivity")
}
else {
if let d = devices {
for device in d {
myPhoton = device
print(myPhoton!)
let funcArgs = ["D7",1] as [Any]
_ = myPhoton?.callFunction("digitalWrite", withArguments: funcArgs) { (resultCode : NSNumber?, error : Error?) -> Void in
if (error == nil) {
print("LED on D7 successfully turned on")
}
}
}
}
}
}
}
}
}
Everything works and I manage to connect to my Particle Photon, however the LED on my Particle Photon doesn’t actually light up. I’m still new to this. Can anyone help me please? Thanks.