Answer to Question #269655 in C for Mr z

Question #269655

1) write a program using arduino or the development board that measures gravitational acceleration in 3-axes and displays the values on the LCD screen.




The program will do the following:






a) To be run upon initialization (i.e. implement this in the setup() function)




• Initialize the development board




• Sound the buzzer




• Write the message “ACCELEROMETER” on the LCD screen.




• Wait two seconds




• Sound the buzzer





1
Expert's answer
2021-11-21T17:33:35-0500
#include <Wire.h>
#include "MMA7660.h"
MMA7660 accelemeter;
int buzzer  = 10;
void setup()
{
	accelemeter.init();  
	Serial.begin(9600);
	Serial.println("ACCELEROMETER: ");
}
void loop()
{
	tone(buzzer,261); 
	int8_t x;
	int8_t y;
	int8_t z;
	float ax,ay,az;
	accelemeter.getXYZ(&x,&y,&z);
	
	delay(500);
	tone(buzzer,261); 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS