Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //LAB 8
- //Crhistian David Lucumi
- //02/10/2014
- int pinarr=4;
- int pinaba=5;
- int pinizq=6;
- int pinder=3;
- int po=A0;
- int pa=A1;
- void setup()
- {
- //initialize serial communications at a 9600 baud rate
- Serial.begin(9600);
- pinMode(pinarr, INPUT);
- pinMode(pinaba, INPUT);
- pinMode(pinizq, INPUT);
- pinMode(pinder, INPUT);
- pinMode(po, INPUT);
- pinMode(pa, INPUT);
- }
- int x;
- int y;
- void loop()
- {
- //send 'Hello, world!' over the serial port
- x=analogRead(po);
- y=analogRead(pa);
- if (y>1022){
- Serial.println("arriba");
- }
- if (y<1){
- Serial.println("abajo");
- }
- if (x>1022){
- Serial.println("der");
- }
- if (x<1){
- Serial.println("izq");
- }
- delay(190);
- //wait 190 milliseconds so we don't drive ourselves crazy
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement