#include //added a library to use the Serial Monitor int rxPin = 0; //the recieving pin int txPin = 1; //the transmitting pin SoftwareSerial Serial(rxPin, txPin); int pin_phototransistor = 2; //pin number 2 int value_phototransistor = 0; //give value to phototransistor void setup() { pinMode(rxPin, INPUT); //the rx pin is the input of the communication pinMode(txPin, OUTPUT); //the tx pin is the output of the communication pinMode(pin_phototransistor, INPUT); //the phototransistor is an input Serial.begin(9600); // to enable communication, should correspond to serial monitor } void loop(){ value_phototransistor = analogRead(pin_phototransistor); // read the value of the phototransistor if (value_phototransistor > 400) { //if it's dark Serial.println("Good night"); } else { Serial.println("Good morning"); //is it's light } }