Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Declare variables
- int x = A0;
- int y = A1;
- int z = 7;
- void setup()
- {
- //Initialize serial communication
- Serial.begin(9600);
- //Set pinmode to input pullup to not have to use a resistor.
- pinMode(7,INPUT_PULLUP);
- }
- void loop()
- {
- //Read values from the ports
- int xVal = analogRead(A0);
- int yVal = analogRead(A1);
- int zVal = digitalRead(7);
- //Print values in the serial
- Serial.print(xVal, DEC);
- Serial.print(",");
- Serial.print(yVal, DEC);
- Serial.print(",");
- Serial.print(zVal, DEC);
- Serial.println();
- //Add delay to make sure that all values go through without errors
- delay (100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement