Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire/HardWire.h>
- HardWire port(2);
- void setup(){
- }
- void loop(){
- char gyroValues[8];
- port.beginTransmission(0x68);
- port.send(0x1B);
- port.endTransmission();
- port.requestFrom(0x68, 8);
- for(int i = 0; i < 8; i++){
- gyroValues[i] = port.receive();
- }
- for(int i = 0; i < 8; i++){
- SerialUSB.print(gyroValues[i], DEC);
- SerialUSB.print(" ");
- }
- SerialUSB.println();
- }
- __attribute__((constructor)) void premain() {
- init();
- }
- int main(void) {
- setup();
- while (true) {
- loop();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment