/* Analog input 4 I2C SDA Analog input 5 I2C SCL */ #include <Wire.h> #define address 0x1E //I2C 7bit address of HMC5883 void setup(){ Serial.begin(9600); Wire.begin(); //Put the HMC5883 IC…
Arduino Code
-
-
This is similar to our DS18B20 example, in this case we merge the BMP085 and an LCD. Code #include <Wire.h> #include <Adafruit_BMP085.h> #include <LiquidCrystal.h> Adafruit_BMP085 bmp; // Connections: Sainsmart LCD/Keypad…
-
The motor driver board contained a ULN2003 This is mainly one of the default examples that comes with the stepper library Code #include <Stepper.h> const int stepsPerRevolution = 512; //…
-
User submitted example for a HC-SR04 Ultrasonic Sensor #define echoPin 7 // Echo Pin #define trigPin 8 // Trigger Pin long duration, distance; // Duration used to calculate distance…
-
Connect an LED to digital pin 3 void setup() { pinMode(3, OUTPUT); } void loop() { for (int a = 0 ; a < 256 ; a++) { analogWrite(3, a);…
-
A new sensor breakout I got recently the BMP05 Barometric, pressure and Temperature sensor. #include <Wire.h> #include <Adafruit_BMP085.h> Adafruit_BMP085 bmp; void setup() { Serial.begin(9600); if (!bmp.begin()) { Serial.println(“Could not…