This is a project for myself. I am happy to show or share any code. My goal is to use Xcode to make a Mac OS application to view and save temperature and light data constantly from my Arduino Duemilanove.
Temperature Sensor: TMP36
Connected to Analog Pin 1
Light Sensor: Photo Resistor and 10k Ohm resistor
Connected to Analog Pin 0
Xcode Version 3.2.4 (1708)
Arduino 0022
Mac 10.6.6
My current Arduino processing code:
CODE
/CODE
Example of Serial Monitor results:
88
44.83
87
44.83
88
44.83
89
46.59
88
45.71
86
44.83
86
45.71
87
45.71
88
44.83
89
44.83
88
44.83
Yes it is that (44F) cold in my house.
Ok, I can use Terminal and cat to save a text file of the serial output:
cat /dev/cu.usbserial-A700dXPO > ArduinoStream.txt
The above command makes a text file in my home folder that will capture the temperature and light level constantly and stop recording when I quit the terminal window.
All that is fun but what I need some advice on how to implement a Xcode project that would allow me to practice the most advanced libraries and get a chance to add more sensing devices and control devices in the future.
If I could start with an application window that just allowed me to look at the Temperature and Light serial output. I will move toward using Xcode to upload the code to the Arduino, but for now I just want to view and store the data coming from my Arduino in a simple Mac OS window.
I can make the pretty little window but as far as the Xcoding I am a lost soul with too many roads toward the light.
I would like to use Core Data. Can I just make a data model and then link to my window?
Any help or advice is appreciated.
Temperature Sensor: TMP36
Connected to Analog Pin 1
Light Sensor: Photo Resistor and 10k Ohm resistor
Connected to Analog Pin 0
Xcode Version 3.2.4 (1708)
Arduino 0022
Mac 10.6.6
My current Arduino processing code:
CODE
Code:
int temperaturePin = 1;
int lightPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop ()
{
int lightLevel = analogRead(lightPin);
lightLevel = map(lightLevel, 0, 900, 0, 255);
lightLevel = constrain(lightLevel, 0, 255);
float temperatureArduino = getVoltage(temperaturePin);
temperatureArduino = (((temperatureArduino - .5) * 100)* 1.8) + 32;
Serial.print(lightLevel);
Serial.println();
delay(1000);
Serial.print(temperatureArduino);
Serial.println();
}
float getVoltage(int pin)
{
return (analogRead(pin) * .004882814);
}
Example of Serial Monitor results:
88
44.83
87
44.83
88
44.83
89
46.59
88
45.71
86
44.83
86
45.71
87
45.71
88
44.83
89
44.83
88
44.83
Yes it is that (44F) cold in my house.
Ok, I can use Terminal and cat to save a text file of the serial output:
cat /dev/cu.usbserial-A700dXPO > ArduinoStream.txt
The above command makes a text file in my home folder that will capture the temperature and light level constantly and stop recording when I quit the terminal window.
All that is fun but what I need some advice on how to implement a Xcode project that would allow me to practice the most advanced libraries and get a chance to add more sensing devices and control devices in the future.
If I could start with an application window that just allowed me to look at the Temperature and Light serial output. I will move toward using Xcode to upload the code to the Arduino, but for now I just want to view and store the data coming from my Arduino in a simple Mac OS window.
I can make the pretty little window but as far as the Xcoding I am a lost soul with too many roads toward the light.
I would like to use Core Data. Can I just make a data model and then link to my window?
Any help or advice is appreciated.
Last edited by a moderator: