0% found this document useful (0 votes)
3 views1 page

Arduino Sensor Reading Code Example

The document contains an Arduino code snippet that reads values from two sensors, left and right, defined by their respective pin numbers. In the setup function, the serial communication is initialized, and in the loop function, it continuously reads the sensor values and prints them to the serial monitor every second. The code uses digitalRead to get the sensor states and outputs them in a formatted manner.

Uploaded by

febireena213
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Arduino Sensor Reading Code Example

The document contains an Arduino code snippet that reads values from two sensors, left and right, defined by their respective pin numbers. In the setup function, the serial communication is initialized, and in the loop function, it continuously reads the sensor values and prints them to the serial monitor every second. The code uses digitalRead to get the sensor states and outputs them in a formatted manner.

Uploaded by

febireena213
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

//sensor variables

#define left_sensor 14

#define right_sensor 8

int l1=0;

int r1=0;

void setup()

// put your setup code here, to run once:

[Link](9600);

void loop() {

// put your main code here, to run repeatedly:

[Link]("sensor value");

l1 = digitalRead(left_sensor);

r1 = digitalRead(right_sensor);

[Link](l1);

[Link]("\t");

[Link](r1);

delay(1000);

You might also like