Arduino Function: RobotControl.compassRead

Description

This method sets the current direction from on-board compass. The values represent degrees of rotation from north (clockwise direction). *North = 0 *East = 90 *South is 180 *West is 270 The compass module may be disrupted by magnetic fields in surrounding areas.

Syntax

Robot.compassRead()

Returns

 int: 0 to 359, representing the number of degrees of rotation from north.

Examples

#include 

void setup(){
  Robot.begin();
  Serial.begin(9600);

}
void loop(){
  Serial.println(Robot.compassRead());
  delay(100);
}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc