In this new tutorial series we will take you step by step through creating a 9-axis IMU capable of monitoring an object’s orientation in 3 dimensional space. In this first lesson we introduce you to IMU and 9-axis sensor basics, and outline the gear we will be using in these lessons. To play along at home, you will need an Arduino Nano, and an Adafruit BNO055 Inertial Measurement Sensor.
Category Archives: Arduino
Arduino Tutorial 23: Changing Tone of an Active Buzzer
If you want to follow along at home, you can order the Arduino Kit we are using HERE.
The video above takes you through the hookup and the steps. Also, the code used in the example above is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
int buzzPin=8; int dt1=1; int dt2=2; int j; void setup() { // put your setup code here, to run once: pinMode(buzzPin, OUTPUT); } void loop() { for (j=1;j<=100;j=j+1){ digitalWrite(buzzPin, HIGH); delay(dt1); digitalWrite(buzzPin, LOW); delay(dt1); } for (j=1; j<=100;j=j+1){ digitalWrite(buzzPin, HIGH); delay(dt2); digitalWrite(buzzPin, LOW); delay(dt2); } } |
Arduino Tutorial 22: Understanding and Using Active Buzzers to Add Sound to Your Project
The advantage of the active buzzer is that it is easier to use. Just apply 5 volts, and it goes off. The advantage of the passive buzzer is that it is cheaper, and allows you more control of the tone, or pitch of the sound produced. If you want to follow along at home, you can order the Arduino Kit we are using HERE.
Arduino Tutorial 21: Understanding and Mixing Primary Colors with an RGB LED
If you want to follow along at home, you can order the Arduino Kit we are using HERE.
The video shows how to connect the circuit, and also takes you step by step through the code. If you need extra help, the code is included below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
int redPin=8; int greenPin=9; int bluePin=10; String myColor; String msg="What Colour Do You Want?"; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(redPin,OUTPUT); pinMode(greenPin,OUTPUT); pinMode(bluePin,OUTPUT); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); while (Serial.available()==0){ } myColor=Serial.readString(); if (myColor=="red"){ digitalWrite(redPin,HIGH); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } if (myColor=="green"){ digitalWrite(redPin,LOW); digitalWrite(greenPin,HIGH); digitalWrite(bluePin,LOW); } if (myColor=="blue"){ digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,HIGH); } if (myColor=="off"){ digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } if (myColor=="yellow"){ analogWrite(redPin,255); analogWrite(greenPin,100); analogWrite(bluePin,0); } if (myColor=="cyan"){ analogWrite(redPin,0); analogWrite(greenPin,255); analogWrite(bluePin,255); } if (myColor=="magenta"){ analogWrite(redPin,255); analogWrite(greenPin,0); analogWrite(bluePin,100); } if (myColor=="aqua"){ digitalWrite(redPin,LOW); analogWrite(greenPin,255); analogWrite(bluePin,80); } } |
Arduino Tutorial 20: Understanding RGB LED’s
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
int redPin=8; int greenPin=9; int bluePin=10; String myColor; String msg="What Colour Do You Want?"; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(redPin,OUTPUT); pinMode(greenPin,OUTPUT); pinMode(bluePin,OUTPUT); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); while (Serial.available()==0){ } myColor=Serial.readString(); if (myColor=="red"){ digitalWrite(redPin,HIGH); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } if (myColor=="green"){ digitalWrite(redPin,LOW); digitalWrite(greenPin,HIGH); digitalWrite(bluePin,LOW); } if (myColor=="blue"){ digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,HIGH); } if (myColor=="off"){ digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } if (myColor=="aqua"){ digitalWrite(redPin,LOW); analogWrite(greenPin,255); analogWrite(bluePin,80); } } |
In these lessons, we are using the Elegoo Arduino kit, which you can purchase HERE.