Changeset - 80205b44ff8a
[Not reviewed]
default
0 3 0
mkroening@CL-ENS241-07.cedarville.edu - 12 years ago 2013-04-04 23:46:57
mkroening@CL-ENS241-07.cedarville.edu
Cameras
3 files changed with 9 insertions and 5 deletions:
0 comments (0 inline, 0 general)
slave/slave/config.h
Show inline comments
 
@@ -28,13 +28,13 @@
 
#define DATATYPES_CAMERA 3
 
 
//Sensors and IO
 
#define SENSOR_LOOP 200				// Frequency of sensor reads (in ms) (should be 200)
 
#define HEATER_THRESHOLD 0			// Temperature threshold in Fahrenheit where heater is activated
 
#define CAMERA_FREQ 30000		// Camera pulse frequency (Should be 30000 for 30 Secs)
 
#define CAMERA_PULSE 500 			// Camera pulse duration
 
#define CAMERA_PULSE 400 			// Camera pulse duration
 
 
 //I2C Addresses
 
 #define EEPROM_ADDR 0xA0		// Read 0xA1 - Write 0xA0
 
 #define BOARDTEMP_ADDR 0x90	// Read 0x91 - Write 0x90
 
 #define PRESSURE_ADDR 0xEE		// Read 0xEF - Write 0xEE
 
 #define HUMID_ADDR 0x27		// Read 0x28 - Write 0x27
slave/slave/lib/i2c.c
Show inline comments
 
@@ -346,12 +346,16 @@ uint16_t i2c_humidRead()
 
	i2c_start(HUMID_ADDR+I2C_READ);		// Measurement Request	
 
 
	data = i2c_readAck();               // read one byte
 
	dataL = i2c_readNak();
 
	i2c_stop();
 
	
 
	data = data << 8;
 
	//data = data << 8;
 
	//data = data | dataL;
 
	
 
	data = data << 10;	//Need this to drop S1 and S0?
 
	data = data >> 2;
 
	data = data | dataL;
 
	
 
	return data;
 
 
}
 
\ No newline at end of file
slave/slave/lib/sensors.c
Show inline comments
 
@@ -183,28 +183,28 @@ void sensors_readPressure()
 
	}
 
	
 
	x1 = (pressure >> 8) * (pressure >> 8);
 
	x1 = (x1 * 3038) >> 16;
 
	x2 = (-7357 * pressure) >> 16;
 
	pressure += (x1 + x2 + 3791) >> 4;				//This is the final value for our pressure
 
	pressure = pressure - 21000;	// Linear Offset for actual pressure
 
	pressure = pressure - 20750;	// Linear Offset for actual pressure
 
	
 
	altitude = (float)44330 * (1 - pow(((float) pressure/101325), 0.190295));	// 101325 THIS IS IN METERS
 
	altitude = (float)44330 * (1 - pow(((float) pressure/105225), 0.190295));	// 101325 THIS IS IN METERS
 
	altitude = altitude * 3.2804;	//THIS IS IN FEET
 
}
 
 
void sensors_readHumid()
 
{
 
	//i2c_write(HUMID_ADDR, 0x00, 0x00);		//Measurement Request
 
	//humid = i2c_read16(HUMID_ADDR);
 
 
	humid = i2c_humidRead();
 
 
	//calculations to relative humidity: humid = (humid/((2^14) - 1))*100%       >> is divide by power, << is multiply by power, 2^14-1 = 16383
 
	 //humid = (humid / 16383) * 100;
 
	 humid = (humid / 10100) * 100;
 
	 //humid = (humid / 2500) * 100;
 
}
 
 
void sensors_readLux()
 
{
 
	lightH = i2c_read(LIGHT_ADDR, 0x03);
 
	lightL = i2c_read(LIGHT_ADDR, 0x04);
0 comments (0 inline, 0 general)