Guest User

Untitled

a guest
Feb 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. // program to serial print using accelerometer
  2. const int groundpin = A1;
  3. const int zpin = A2;
  4. const int ypin = A3;
  5. const int xpin = A4;
  6. const int powerpin = A5;
  7. void setup() {
  8. // put your setup code here, to run once:
  9.  
  10. Serial.begin(9600);
  11. pinMode(groundpin,OUTPUT);
  12. pinMode(powerpin, OUTPUT);
  13. digitalWrite(groundpin,0);
  14. digitalWrite(powerpin,1);
  15. pinMode(12,OUTPUT);
  16. }
  17.  
  18. void loop() {
  19. // put your main code here, to run repeatedly:
  20.  
  21. Serial.print (analogRead(xpin));
  22. delay(500);
  23. Serial.print("\t");
  24. Serial.print (analogRead(ypin));
  25. delay(500);
  26. Serial.print ("\t");
  27. Serial.print (analogRead(zpin));
  28. Serial.println();
  29. delay(500);
  30.  
  31. }
Add Comment
Please, Sign In to add comment