Alright, so I’m at wits’ end.
I have an app that utilizes pushing and popping viewControllers. one of my viewControllers has the basic setup for reading input from the Arduino Uno (utilizing the Redpark cable).
When I pop that view controller off the app dies and I do not know what is causing it. I know it has to do with the Redpark coding because without it the app works fine.
When I insert the Redpark coding into the other viewControllers the app doesn’t die but the text that I have to read the serial code disappears.
So what is causing it to crash? Or not show the data.
I think it has to do with [rscMgr open] command. Any input would be useful.
EDIT: let me also ask. Is there a way to run this process of reading the serial data in the background of my app? That might solve the problem.
So I believe I solved the problem, or just put a band-aid on it.
Throughout the book “iOS Sensor Apps with Arduino” by Alasdair Allen all the examples were created in the main viewController.
I was playing around with the examples plus extra view controllers. I came to the realization that the main viewController is ALWAYS RUNNING.
What I did to solve the problem was to create a global variable that held the inputs and then printed it to the pushed viewController.
I also used a timer to update the value in the pushed viewController.
So…
Create a variable that will hold the input. I did this in the AppDelegate class (I tend to put all global variables in the AppDelegate).
Run the Redpark Serial input on the main viewController using
rxBuffedvariable (could call it anything you want).Create your timer in your viewController that you want the RX data. I update every 1/10th of a second.
Import that variable in the updateValues.