0% found this document useful (0 votes)
24 views3 pages

Transmitter

The document defines constants and variables for analog pin readings and initializes serial communication. It then reads the pin values in a loop and prints characters to the serial port based on the pin values to indicate movement directions.

Uploaded by

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

Transmitter

The document defines constants and variables for analog pin readings and initializes serial communication. It then reads the pin values in a loop and prints characters to the serial port based on the pin values to indicate movement directions.

Uploaded by

Nani Nani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

const int x1=A1;

const int y1=A2;


//const int x2=A2;
//const int y2=A3;
int xval1,xval2,yval1,yval2;
//int sw1=2;
//int sw2=3;
//int sw1val;
//int sw2val;

void setup()
{
Serial.begin(9600);
pinMode(x1,INPUT);
pinMode(y1,INPUT);
//pinMode(x2,INPUT);
// pinMode(y2,INPUT);
// pinMode(sw1,INPUT);
// pinMode(sw2,INPUT);
}

void loop()
{
xval1=analogRead(x1);
//Serial.println(xval1);
//xval2=analogRead(x2);
//Serial.println(xval2);
yval1=analogRead(y1);
//Serial.println(yval1);
//yval2=analogRead(y2);
// Serial.println(yval2);
delay(1000);

if(xval1>400)

Serial.print('L');
//Serial.println("left side ");
//delay(1000);
}
else if(xval1<290)

Serial.print('R');
//Serial.println("right side ");
//delay(1000);
}

else if(yval1>400)

Serial.print('F');
//Serial.println("forward ");
//delay(1000);
}
else if(yval1<290)

Serial.print('B');
// Serial.println("backward ");
//delay(1000);
}

else
{
Serial.print('S');
}

/*else if(xval2>=390)

Serial.print('P');
//Serial.println("picking ");
delay(1000);
}
else if(xval2<=290)

Serial.print('E');
//Serial.println(" release ");
delay(1000);
}

else if(yval2>=390)

Serial.print('D');
//Serial.println("DOWN");
delay(1000);
}

else if(yval2<=290)

Serial.print('U');
//Serial.println("UP");
delay(1000);
}

/*if(sw1val==LOW)
{

Serial.print('P');
Serial.println("pick");
delay(1000);
}
if(sw2val==LOW)
{

Serial.print('E');
Serial.println("release");
delay(1000);
}*/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy