/* This code can be used for arduino serial connection which will send * Tempreture and Light intensity values to serial devices connected to * Arduino UNO * _________________________________________________ * | Creator--> RITVIK DAVE | * | Email----> "ritvikdaveidra@gmail.com" | ------------------------------------------------- Circuit for this code ____________________________________________________________________________________________ "" * Connect Tempreture sensor's output to Analog pin "A0" of Arduino "" "" * Connect LDR's output to Analog pin A1 of arduino "" ____________________________________________________________________________________________ */ // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0 which is tempreture sensor's value : int sensorValue1 = analogRead(A0); // convert the value from tempreture sensor in degree calcius int temp = (int(sensorValue1) * float(4.8824)-500)/10; // read the input on analog pin 1 which is light sensor's value: int sensorValue2 = analogRead(A1); // convert the value from light sensor into lux int Lux = 1024.0 * 10 / sensorValue2 - 10; // print out the value you read: Serial.print(temp);Serial.print(" ");Serial.print(Lux);Serial.print("\n"); // Converting the data in the format of "temp_readinglight_intensity" delay(1000); // delay in between reads for stability }