// Define the pin to be used const int pirPin = 2; // Pin of the motion sensor void setup() { // Initialize the pin as input pinMode(pirPin, INPUT); // Initialize serial communication Serial.begin(9600); } void loop() { // Read the value of the motion sensor pin int motion = digitalRead(pirPin); // Print the value to the serial console Serial.println(motion); // Wait a moment before repeating delay(1000); }