Repository: rmorenojr/ElegooTutorial Branch: master Commit: 3566417be56d Files: 94 Total size: 494.1 KB Directory structure: gitextract_6jbdws48/ ├── Lesson 10 - Ultrasonic Sensor Module/ │ ├── HC-SR04/ │ │ ├── SR04.cpp │ │ └── SR04.h │ ├── Lesson10.fzz │ ├── README.md │ ├── UltrasonicDistance/ │ │ └── UltrasonicDistance.ino │ ├── UltrasonicDistanceLCD/ │ │ └── UltrasonicDistanceLCD.ino │ ├── UltrasonicSensorLCD.fzz │ └── mySR04_Example/ │ └── mySR04_Example.ino ├── Lesson 11 - Keypad Membrane Switch Module/ │ ├── Analog_keypad/ │ │ └── Analog_keypad.ino │ ├── Keypad_4x4_1analogPin.fzz │ ├── Ladder.xlsm │ └── README.md ├── Lesson 12 - DHT11/ │ ├── DHT11_Decimal/ │ │ └── DHT11_Decimal.ino │ └── README.md ├── Lesson 13 - Analog Joystick Module/ │ ├── Analog_Joystick_OLEDcursor/ │ │ └── Analog_Joystick_OLEDcursor.ino │ └── README.md ├── Lesson 14 - IR Receiver Module/ │ ├── IR_Receiver_Module/ │ │ └── IR_Receiver_Module.ino │ └── README.md ├── Lesson 15 - MAX7219 Module/ │ ├── LEDGraphicToHex.xlsm │ ├── MyMarqueeText/ │ │ └── MyMarqueeText.ino │ └── README.md ├── Lesson 16 - GY-521 Module/ │ ├── MPU-6050_expanded/ │ │ └── MPU-6050_expanded.ino │ └── README.md ├── Lesson 17 - HC-SR501/ │ ├── HC-SR501_Demo/ │ │ └── HC-SR501_Demo.ino │ ├── HC-SR501_plus.fzz │ └── README.md ├── Lesson 18 - Water Level Detection Sensor Module/ │ ├── README.md │ └── Water_level/ │ └── Water_level.ino ├── Lesson 19 - Real Time Clock Module/ │ ├── README.md │ └── RTC_Alarm/ │ ├── RTC_Alarm.ino │ ├── RTC_Alarm.ino.standard.hex │ └── RTC_Alarm.ino.with_bootloader.standard.hex ├── Lesson 20 - Sound Sensor Module/ │ ├── Lesson20.fzz │ ├── README.md │ ├── SoundSensor/ │ │ └── SoundSensor.ino │ └── SoundSensor.fzz ├── Lesson 21 - RC522 RFID Module/ │ ├── README.md │ └── RFID_module/ │ └── RFID_module.ino ├── Lesson 22 - LCD Display/ │ ├── HelloWorld/ │ │ └── HelloWorld.ino │ ├── I2C_check/ │ │ └── I2C_check.ino │ ├── LCD1602A.fzz │ ├── LCD1602A_I2C.fzz │ └── README.md ├── Lesson 23 - Thermometer/ │ ├── README.md │ ├── Thermistor Calculator.xlsx │ ├── Thermistor.fzz │ └── Thermometer/ │ └── Thermometer.ino ├── Lesson 24 - 74HC595 Shift Register/ │ ├── 74HC595.fzz │ ├── B2B_74HC595.fzz │ ├── README.md │ ├── SR_74HC595/ │ │ └── SR_74HC595.ino │ ├── SR_74HC595_16bit/ │ │ └── SR_74HC595_16bit.ino │ └── SR_74HC595_32bit/ │ └── SR_74HC595_32bit.ino ├── Lesson 26 - Photocell/ │ └── PhotoCell.fzz ├── Lesson 27 - 74HC595 and Segment Display/ │ ├── 7-SegmentDisplay/ │ │ └── 7-SegmentDisplay.ino │ ├── 74HC595_7SegmentDisplay.fzz │ ├── 74HC595_SegmentDisplay.xlsx │ └── README.md ├── Lesson 28 - 4 Digit 7 Segment Display/ │ ├── 4Digit_7SegmentDisplay.xlsx │ ├── 4_digit_proper.fzz │ ├── Four_Digit_HexCounter/ │ │ └── Four_Digit_HexCounter.ino │ └── README.md ├── Lesson 29 - DC Motors/ │ ├── DC_Motor/ │ │ └── DC_Motor.ino │ └── DC_Motor.fzz ├── Lesson 4 - RGB LED/ │ ├── Lesson4.fzz │ ├── README.md │ └── RGB_LED/ │ └── RGB_LED.ino ├── Lesson 5 - Digital Inputs/ │ ├── DigitalInput_Debounce/ │ │ ├── DigitalInput_Debounce.ino │ │ └── Lesson 5 Single Button Sketch.fzz │ ├── DigitalInput_DeepSleep/ │ │ └── DigitalInput_DeepSleep.ino │ ├── Lesson 5 Sketch.fzz │ └── README.md ├── Lesson 6 - Active Buzzer/ │ ├── Lesson 6.fzz │ ├── MorseCode_Translator/ │ │ ├── Morse Code Translator.fzz │ │ └── MorseCode_Translater/ │ │ └── MorseCode_Translater.ino │ └── README.md ├── Lesson 7 - Passive Buzzer/ │ ├── HappyBirthday/ │ │ └── HappyBirthday.ino │ ├── Lesson7.fzz │ ├── MusicPlayer.fzz │ ├── MusicPlayer2.fzz │ ├── README.md │ ├── StarWarsImperialMarch/ │ │ └── StarWarsImperialMarch.ino │ └── SuperMario/ │ └── SuperMario.ino ├── Lesson 8 - Tilt Ball Switch/ │ ├── Magic8-Ball.fzz │ ├── Magic_8-Ball/ │ │ └── Magic_8-Ball.ino │ ├── README.md │ └── myBall_Switch/ │ └── myBall_Switch.ino ├── Lesson 9 - Servo/ │ ├── Lesson 9 Servo_RotaryEncoder.fzz │ ├── README.md │ └── ServoRangeCal_Ctrl/ │ └── ServoRangeCal_Ctrl.ino ├── README.md ├── UNLICENSE ├── _config.yml └── library.properties ================================================ FILE CONTENTS ================================================ ================================================ FILE: Lesson 10 - Ultrasonic Sensor Module/HC-SR04/SR04.cpp ================================================ #include "SR04.h" SR04::SR04(int echoPin, int triggerPin) { _echoPin = echoPin; _triggerPin = triggerPin; pinMode(_echoPin, INPUT); pinMode(_triggerPin, OUTPUT); _autoMode = false; _distance = 999.; } float SR04::Distance() { float d = 0.; _duration = 0; digitalWrite(_triggerPin, LOW); delayMicroseconds(2); digitalWrite(_triggerPin, HIGH); delayMicroseconds(10); digitalWrite(_triggerPin, LOW); delayMicroseconds(2); _duration = pulseIn(_echoPin, HIGH, PULSE_TIMEOUT); d = MicrosecondsToCentimeter(_duration); delay(25); return d; } float SR04::DistanceAvg(int wait, int count) { float min, max, avg, d; min = 999.; max = 0.; avg = d = 0.; if (wait < 25) { wait = 25; } if (count < 1) { count = 1; } for (int x = 0; x < count + 2; x++) { d = Distance(); if (d < min) { min = d; } if (d > max) { max = d; } avg += d; } // substract highest and lowest value avg -= (max + min); // calculate average avg /= count; return avg; } void SR04::Ping() { _distance = Distance(); } float SR04::getDistance() { return _distance; } float SR04::MicrosecondsToCentimeter(long duration) { float d = (duration * 100.) / 5882.; //d = (d == 0)? 999:d; return d; } long SR04::pingTime() { return _duration; } ================================================ FILE: Lesson 10 - Ultrasonic Sensor Module/HC-SR04/SR04.h ================================================ #ifndef SR04_H #define SR04_H #if defined(ARDUINO) && ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif //#include "pins_arduino.h" #include #define PULSE_TIMEOUT 150000L // 100ms #define DEFAULT_DELAY 10 #define DEFAULT_PINGS 5 class SR04 { public: /** * Constructor * Ultrasonic sensor SR04, four connections pins * VCC, ECHO, TRIGGER, GND *
* \param echoPin digital INPUT-Pin for measuring distance * \param triggerPin if 10us high a trigger signal is generated from * SR04 * * \return void */ SR04(int echoPin, int triggerPin); /** * Do a measurment for this sensor. Return distance as long * in centimenter * \return long distance in centimeter */ float Distance(); /** * Do count measurents and calculate the average. * To avoid defilement from ow/high peaks, min/max values * are substracted from the average * * \param wait delay between measurements, default = DEFAULT_DELAY/ms * \param count number of measurements, default DEFAULT_PINGS * \return long distance in centimeter **/ float DistanceAvg(int wait=DEFAULT_DELAY, int count=DEFAULT_PINGS); /** * Do only a ping. Get result with methode getDistance() * * \param keine */ void Ping() ; /** * return latest distance. Methode Ping() should be called before * \param keine * \return Distanz in Zentimeter */ float getDistance(); /** * return latest duration time * can be called after a distance method call * returns a long */ long pingTime(); private: /** * Do the measurement calculation and return result in centimeter * SR04 measure echo time to obstacle and return way. *
* Sound travels with 340m/sec *
* Example: Obstace 100cm away from SR04. Measure time is 100cm to * obstacle and 100cm return = 200cm *
* 1sec = 1000ms = 1,000,000uS * 1,000,000 / 340 = Distance in microseconds for 100cm * 2941uS fuer 100cm = 5882 uS fuer 200cm * * duration / 5882 * 100 = distance in cm */ float MicrosecondsToCentimeter(long duration); float _currentDistance; int _echoPin, _triggerPin; long _duration; float _distance; bool _autoMode; }; #endif ================================================ FILE: Lesson 10 - Ultrasonic Sensor Module/README.md ================================================ # ElegooTutorial ## Lesson 10 - Ultrasonic Sensor Module [YouTube video](https://youtu.be/URi7Eh26VRY) A beginner's guide to the Most Complete Starter Kit by Elegoo. **Lesson 10 Ultrasonic Sensor Module** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 10 "Ultrasonic Sensor Module". This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. I'm pronouncing it El-E-Goo, I hope that's right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, we'll need a few things from your Elegoo Arduino kit. I'll list the items below. In this lesson we're going to learn about the Ultrasonic Sensor Module provided in the kit and how to use it in our projects. I step through the Elegoo provided code, which uses a Library, and explain how it makes this happen. Then I develop a sketch, without the need of a Library, to fully demonstrate how the sensor module works. I discuss a little about the speed of sound, and finally I create a circuit that includes a display and an interrupt driven button to switch modes. I run across a few issues and the solutions to fix them. Fun project, I hope you enjoy it. ## Parts youll need for the basic tutorial * Elegoo Arduino UNO R3 board * Ultrasonic Sensor Module HC-SR04 * Four male-to-male jumpers * Breadboard * Miscellaneous breadboard jumpers * Temperature gauge * And a ruler ## Additional items needed * LCD 1602 16x2 screen module * 10K potentiometer * Tactile push button switch * And a few more male-to-male jumpers and breadboard jumpers The next lesson will be **Lesson 11 Membrane Switch Module** ## Links This lesson's sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [attachinterrupt](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/) * [Switch Case control](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) * [Pin Change Interrupt](http://playground.arduino.cc/Main/PinChangeInterrupt) * [Port Registers](https://www.arduino.cc/en/Reference/PortManipulation) * [LESSON 17 Measure Speed of Sound with Arduino and Ultrasonic Sensor](https://www.youtube.com/watch?v=eaHRHQ5Ca_U) * [Lesson 18 Measure Distance with Arduino and Ultrasonic Sensor](https://www.youtube.com/watch?v=rTM5gZxBPmY) by Paul McWhorter * [Interrupts](http://gammon.com.au/interrupts) BY Nick Gammon * [Speed of Sound in Air](http://hyperphysics.phy-astr.gsu.edu/hbase/Sound/souspe.html) * [Speed of Sound Wikipedia](https://en.wikipedia.org/wiki/Speed_of_sound#Details) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_04_-_Roller-skate](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 10 - Ultrasonic Sensor Module/UltrasonicDistance/UltrasonicDistance.ino ================================================ /*Ultrasonic Distance - using the HC-SR04 Ultrasonic Sensor Module * By Ricardo Moreno * 02/13/208 * * Using the Ultrasonic Sensor without a Library * * Inspired by: * LESSON 17: Measure Speed of Sound with Arduino and Ultrasonic Sensor * https://www.youtube.com/watch?v=eaHRHQ5Ca_U * * Lesson 18: Measure Distance with Arduino and Ultrasonic Sensor by Paul McWhorter * https://www.youtube.com/watch?v=rTM5gZxBPmY * * Speed of sound * changes with with temperature * at 68 degrees F (20 degrees C) * 741 Miles per hour * 1087 feet per sec * 343.2 meters per second * 776.5 Miles per Hour (Mph) @ 77 degrees F - Paul McWhorter * 345.2944 meters per second @ 73 degrees F * Formula for speed of sound with temperature change: * sos = 331.5*sqrt(1+C/273.15) - in meters per second - C is degrees C */ // HC-SR04 module pins const int triggerPin = 12; const int echoPin = 11; //Global Variables //float speedOfSound = 343.2; //Meters per second @ 20C or 68F float speedOfSound = 343.2611; //Meters per second @ 67F float conversionFactor = .0001; //conversion factor for meters to cm & uSec to Sec unsigned int pingTime = 0; //The time single round trip time - avail after call to distance unsigned int pingTimeAvg = 0; //The average round trip time - avail after call to distanceAvg /* ******************************************************* * Setup ********************************************************* */ void setup() { pinMode(triggerPin,OUTPUT); pinMode(echoPin,INPUT); Serial.begin(9600); //Enable the Serial Monitor delay(1000); } /* ******************************************************* * Functions ********************************************************* */ float distance(){ /* distance returns a float value in centimeters * Parameters: none */ float dist = 0.0; digitalWrite(triggerPin, LOW); //Set the trigger pin low delayMicroseconds(5); //pause to let signal settle digitalWrite(triggerPin, HIGH); delayMicroseconds(12); //pause HIGH state digitalWrite(triggerPin, LOW); //Bring trigger down low //Change the global variable pingtime pingTime = pulseIn(echoPin, HIGH, 18000);//Measure ping time at echo pin in microseconds //timeout time in microseconds max about 3 meters //distance = speed of sound (meters per second) * 1000cm/meter * ping time/2 (uSeconds) * 1sec/1000000uSec dist = speedOfSound * conversionFactor * pingTime/2; //convert the target distance to cm return dist; } float distanceAvg(unsigned int wait=1, unsigned int pings=5, unsigned int trimPercent=0){ /* distanceAvg returns a float value in centimeters * Parameters: * [optional]wait - the time between distance checks in milliseconds, * default value is 1 * [optional]pings - the number of distance checks, default value is 5 * [optional]trimPercent - this is kinda like EXCEL's TRIMMEAN function * Based upon the trim percentage passed, it * determines the trim count from minimum and * maximum values: * trimCount = rounddown(pings*(trimPercent/100)/2) * default value is zero which doesn't trim outlying points */ float minVal = 0.0; unsigned long minTime = 0; float maxVal = 0.0; unsigned long maxTime = 0; float d[pings]; float t[pings]; float avgDist = 0.0; unsigned long avgTime = 0; unsigned int count = pings; unsigned int trimCount = 0; //Parameter checking if (count < 1) count = 1; if (wait < 1) wait = 1; //time in milliseconds if (trimPercent < 0) trimPercent = 0; if (trimPercent > 100) trimPercent = 100; if (trimPercent == 0){ trimCount = 0; } else { trimCount = int(count*(trimPercent/100.)/2.); //always round down to nearest integer if (trimCount == 0) trimCount=1; } //Get all the raw data for (int x = 0; x < count; x++) { d[x] = distance(); if ((minVal > d[x])||(minVal == 0)) minVal=d[x]; if ((maxVal < d[x])||(maxVal == 0)) maxVal=d[x]; t[x] = pingTime; if ((minTime > pingTime)||(minTime == 0)) minTime = pingTime; if ((maxTime < pingTime)||(maxTime == 0)) maxTime = pingTime; avgDist += d[x]; avgTime += pingTime; delay(wait); } //No need to sort if trimCount = 0 or 1 if ((count > 1)&&(trimCount > 1)){ //Insert sort routine //http://forum.arduino.cc/index.php?topic=49059.0 //Sort distances for (int i = 1; i < count; ++i){ float temp = d[i]; int k; for (k = i - 1; (k >= 0) && (temp < d[k]); k--){ d[k + 1] = d[k]; } d[k + 1] = temp; } //sort ping times for (int i = 1; i < count; ++i){ float temp = t[i]; int k; for (k = i - 1; (k >= 0) && (temp < t[k]); k--){ t[k + 1] = t[k]; } t[k + 1] = temp; } } if (trimCount == 1){ // substract highest and lowest values avgDist -= (maxVal + minVal); avgTime -= (maxTime + minTime); count -= 2; }else if (trimCount > 1){ //subtract the highest and lowest points //subtract the lowest data points for (int i = 0; i < trimCount; i++) { avgDist -= d[i]; avgTime -= t[i]; } //subtract the highest data points for (int i = count-1; i > (count-1-trimCount); i--){ avgDist -= d[i]; avgTime -= t[i]; } count -= trimCount*2; //revise count less the upper and lower trimcounts } //Else assume trimCount == 0 // calculate average avgDist /= count; avgTime /= count; pingTimeAvg = avgTime; //Set global value pingTimeAvg return avgDist; } /* ******************************************************* * Void Loop ********************************************************* */ void loop(){ unsigned int timeValue; //The system time float answer = distance(); Serial.println("Single shot functions"); Serial.print(" Distance = "); Serial.print(answer); //in centimeters Serial.println(" cm"); answer /= 2.54; Serial.print(" Distance = "); Serial.print(answer); //in inches Serial.println(" inches"); Serial.print(" Single round trip time "); Serial.print(pingTime); Serial.println(" uSeconds"); Serial.println(""); delay(25); //Find a distance average with a trim mean of 20 percent timeValue = millis(); answer = distanceAvg(2, 20, 20); timeValue = millis() - timeValue; Serial.println("Average functions:"); Serial.print(" Distance = "); Serial.print(answer); Serial.println(" cm"); answer /= 2.54; Serial.print(" Distance = "); Serial.print(answer); //in inches Serial.println(" inches"); Serial.print(" Average round trip time is "); Serial.println(pingTimeAvg); Serial.println(""); Serial.print("It took "); Serial.print(timeValue); Serial.println(" milliseconds to complete"); Serial.println("function distance average"); Serial.println(""); delay(2000); } ================================================ FILE: Lesson 10 - Ultrasonic Sensor Module/UltrasonicDistanceLCD/UltrasonicDistanceLCD.ino ================================================ /*Ultrasonic Distance LCD - using the HC-SR04 Ultrasonic Sensor Module with LCD * By Ricardo Moreno * 02/13/208 * * Using the Ultrasonic Sensor without a Library * * Inspired by: * LESSON 17: Measure Speed of Sound with Arduino and Ultrasonic Sensor * https://www.youtube.com/watch?v=eaHRHQ5Ca_U * * Lesson 18: Measure Distance with Arduino and Ultrasonic Sensor by Paul McWhorter * https://www.youtube.com/watch?v=rTM5gZxBPmY * * Speed of sound * changes with with temperature * at 68 degrees F (20 degrees C) * 741 Miles per hour * 1087 feet per sec * 343.2 meters per second * 776.5 Miles per Hour (Mph) @ 77 degrees F - Paul McWhorter * 345.2944 meters per second @ 73 degrees F * Formula for speed of sound with temperature change: * sos = 331.5*sqrt(1+C/273.15) - in meters per second - C is degrees C */ /* ****************** INCLUDE LIBRARIES ********************** */ #include /* ******************* GLOBAL CONSTANTS ********************** */ //Initialize library with LCD screen // LiquidCrystal(rs, enable, d4, d5, d6, d7) // or // LiquidCrystal(rs, rw, enable, d4, d5, d6, d7) LiquidCrystal lcd(11, 10, 9, 6, 5, 4, 3); //instantiates the LiquiCrystal Object class to variable lcd // HC-SR04 module pins const int triggerPin = 12; const int echoPin = 13; //Button const int buttonPin = 2; /* ******************* GLOBAL VARIABLES ********************** */ //float speedOfSound = 343.2; //Meters per second @ 20C or 68F float speedOfSound = 346.9210755; //Meters per second @ 67F float conversionFactor = .0001; //conversion factor for meters to cm & uSec to Sec unsigned int pingTime = 0; //The time single round trip time - avail after call to distance unsigned int pingTimeAvg = 0; //The average round trip time - avail after call to distanceAvg volatile bool buttonState = false; //Keeps track of the button state /* ******************************************************* * Setup ********************************************************* */ void setup() { lcd.begin(16, 2); //16 characters and two lines pinMode(triggerPin,OUTPUT); pinMode(echoPin,INPUT); //Set echo pin as input pinMode(buttonPin,INPUT_PULLUP); //Set button pin as input with pullup resistors //Attach to interrupt 0 on pin 2 attachInterrupt(digitalPinToInterrupt(buttonPin), Button_isr, CHANGE); Serial.begin(9600); //Enable the Serial Monitor lcd.print(" Distance Time"); //prints the line of text lcd.setCursor(0,1); //moves the cursor to the next line lcd.print(" 0.0cm 0000us"); //prints second line of text } /* ******************************************************* * Functions ********************************************************* */ float distance(){ /* distance returns a float value in centimeters * Parameters: none */ float dist = 0.0; digitalWrite(triggerPin, LOW); //Set the trigger pin low delayMicroseconds(5); //pause to let signal settle digitalWrite(triggerPin, HIGH); delayMicroseconds(12); //pause HIGH state digitalWrite(triggerPin, LOW); //Bring trigger down low //Change the global variable pingtime pingTime = pulseIn(echoPin, HIGH, 18000);//Measure ping time at echo pin in microseconds //timeout time in microseconds max about 3 meters //distance = speed of sound (meters per second) * 1000cm/meter * ping time/2 (uSeconds) * 1sec/1000000uSec dist = speedOfSound * conversionFactor * pingTime/2; //convert the target distance to cm return dist; } float distanceAvg(unsigned int wait=1, unsigned int pings=5, unsigned int trimPercent=0){ /* distanceAvg returns a float value in centimeters * Parameters: * [optional]wait - the time between distance checks in milliseconds, * default value is 1 * [optional]pings - the number of distance checks, default value is 5 * [optional]trimPercent - this is kinda like EXCEL's TRIMMEAN function * Based upon the trim percentage passed, it * determines the trim count from minimum and * maximum values: * trimCount = rounddown(pings*(trimPercent/100)/2) * default value is zero which doesn't trim outlying points */ float minVal = 0.0; unsigned long minTime = 0; float maxVal = 0.0; unsigned long maxTime = 0; float d[pings]; float t[pings]; float avgDist = 0.0; unsigned long avgTime = 0; unsigned int count = pings; unsigned int trimCount = 0; //Parameter checking if (count < 1) count = 1; if (wait < 1) wait = 1; //time in milliseconds if (trimPercent < 0) trimPercent = 0; if (trimPercent > 100) trimPercent = 100; if (trimPercent == 0){ trimCount = 0; } else { trimCount = int(count*(trimPercent/100.)/2.); //always round down to nearest integer if (trimCount == 0) trimCount=1; } //Get all the raw data for (int x = 0; x < count; x++) { d[x] = distance(); if ((minVal > d[x])||(minVal == 0)) minVal=d[x]; if ((maxVal < d[x])||(maxVal == 0)) maxVal=d[x]; t[x] = pingTime; if ((minTime > pingTime)||(minTime == 0)) minTime = pingTime; if ((maxTime < pingTime)||(maxTime == 0)) maxTime = pingTime; avgDist += d[x]; avgTime += pingTime; delay(wait); } //No need to sort if trimCount = 0 or 1 if ((count > 1)&&(trimCount > 1)){ //Insert sort routine //http://forum.arduino.cc/index.php?topic=49059.0 //Sort distances for (int i = 1; i < count; ++i){ float temp = d[i]; int k; for (k = i - 1; (k >= 0) && (temp < d[k]); k--){ d[k + 1] = d[k]; } d[k + 1] = temp; } //sort ping times for (int i = 1; i < count; ++i){ float temp = t[i]; int k; for (k = i - 1; (k >= 0) && (temp < t[k]); k--){ t[k + 1] = t[k]; } t[k + 1] = temp; } } if (trimCount == 1){ // substract highest and lowest values avgDist -= (maxVal + minVal); avgTime -= (maxTime + minTime); count -= 2; }else if (trimCount > 1){ //subtract the highest and lowest points //subtract the lowest data points for (int i = 0; i < trimCount; i++) { avgDist -= d[i]; avgTime -= t[i]; } //subtract the highest data points for (int i = count-1; i > (count-1-trimCount); i--){ avgDist -= d[i]; avgTime -= t[i]; } count -= trimCount*2; //revise count less the upper and lower trimcounts } //Else assume trimCount == 0 // calculate average avgDist /= count; avgTime /= count; pingTimeAvg = avgTime; //Set global value pingTimeAvg return avgDist; } void LCDshow(float distance1=0.0, int time1=0000){ lcd.clear(); lcd.setCursor(0,0); if (buttonState){ //Average lcd.print(" AvgDist AvgT"); //prints the line of text } else { //single shot lcd.print(" Distance Time"); //prints the line of text } lcd.setCursor(0,1); //moves the cursor to the next line int lenValue = 6-String(distance1,2).length(); lcd.setCursor(lenValue,1); lcd.print(distance1); //lcd.setCursor(7,1); lcd.print("cm"); lcd.setCursor(10,1); lcd.print(time1); lcd.print("us"); //lcd.print(" 0.0 0000"); //prints second line of text } void Button_isr(){ // Button Interrupt Service Routine using an interrupt //Serial.println("button press"); boolean current = digitalRead(buttonPin); if(current != HIGH){ delay(5); //5 milliseconds current = digitalRead(buttonPin); } if(current == LOW) buttonState = !buttonState; } /* ******************************************************* * Void Loop ********************************************************* */ void loop(){ float answer; unsigned int timeValue; //The system time if (!buttonState){ answer = distance(); LCDshow(answer,pingTime); Serial.println("Single shot functions"); Serial.println(" Distance Time "); Serial.print(answer); //in centimeters Serial.print(" cm OR "); answer /= 2.54; Serial.print(answer); //in inches Serial.print(" inches "); Serial.print(pingTime); Serial.println(" uSeconds"); Serial.println(""); } else { //Find a distance average with a trim mean of 20 percent timeValue = millis(); answer = distanceAvg(2, 20, 20); timeValue = millis() - timeValue; LCDshow(answer,pingTimeAvg); Serial.println("Average functions:"); Serial.println(" AvgDistance AvgTime "); Serial.print(answer); Serial.print(" cm OR "); answer /= 2.54; Serial.print(answer); //in inches Serial.print(" inches "); Serial.print(pingTimeAvg); Serial.println(" uSeconds"); Serial.print("(distance average took "); Serial.print(timeValue); Serial.println(" msec to complete)"); Serial.println(""); } delay(1000); } ================================================ FILE: Lesson 10 - Ultrasonic Sensor Module/mySR04_Example/mySR04_Example.ino ================================================ //www.elegoo.com //2016.12.08 #include "SR04.h" #define TRIG_PIN 12 #define ECHO_PIN 11 SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN); float a; void setup() { Serial.begin(9600); delay(1000); } void loop() { long pingDuration; a=sr04.Distance(); pingDuration = sr04.pingTime(); Serial.print(a); Serial.println("cm"); Serial.print(pingDuration); Serial.println(" round trip in microseconds"); delay(1000); } ================================================ FILE: Lesson 11 - Keypad Membrane Switch Module/Analog_keypad/Analog_keypad.ino ================================================ /*Analog Keypad - using the Membrane Switch Module * By Ricardo Moreno * 02/13/208 * * Using the Membrane Switch Module without a Library * and one analog pin * * Inspired by: * HariFun #143 - How to read a 4x4 keypad using just one Arduino pin! * https://www.youtube.com/watch?v=G14tREsVqz0 */ /* ******************* GLOBAL CONSTANTS ********************** */ const int analogPin = A0; //Analog pin that we are connecting to /* ******************* GLOBAL VARIABLES ********************** */ //Analog values for various resistor ladder values int analogValues[] = {0,68,128,181, 220,263,301,336, 362,391,418,443, 461,483,502,520}; //Keypad character values, Row0 through Row3 //char* keypadButton[] = {"1","2","3","A", // "4","5","6","B", // "7","8","9","C", // "*","0","#","D"}; char keypadButton[] = "123A456B789C*0#D"; int analogValuesSize; /* ******************************************************* * Setup ********************************************************* */ void setup(){ // setup code: Serial.begin(9600); analogValuesSize = sizeof(analogValues)/sizeof(int); //Get the array size } /* ******************************************************* * Void Loop ********************************************************* */ void loop(){ // main code: int value = analogRead(analogPin); //get analog value if (value<1000){ analogKeyPress(value);} //if the value is something other than 1023 // run analogKeyPress subroutine } /* ******************************************************* * Functions ********************************************************* */ int debounce(int last){ /* function debounce - button debouncing routine. Double-checks the button press to value * Parameter: * last - what the initial value was */ //Local Variable delay(10); //Small delay int current = analogRead(analogPin); //get latest analog value if(abs(current - last) > 5){ //if current >> last then get a new value delay(5); //5 milliseconds current = analogRead(analogPin); } return current; //Return analog value } void analogKeyPress(int value){ /* subroutine analogKeyPress - Sends the keypressed to the serial monitor * Parameter: * value - passed analog read value */ value = debounce(value); //Call Debounce routine and get final value for (int i = 0; i < analogValuesSize; i++){ //Search through analogValues to get keypad pressed if (abs(value - analogValues[i]) < 5){ Serial.println(keypadButton[i]); //Send keypad character to Serial Monitor //Serial.println(value); while(analogRead(analogPin) < 1000){delay(100);} //Wait until keypad button is released } } } ================================================ FILE: Lesson 11 - Keypad Membrane Switch Module/README.md ================================================ # ElegooTutorial ## Lesson 11 Keyboard Membrane Switch Module [YouTube video](https://youtu.be/URi7Eh26VRY) A beginner's guide to the Most Complete Starter Kit by Elegoo. ** Lesson 11 Membrane Switch Module ** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 11 Membrane Switch Module. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. Im pronouncing it El-E-Goo, I hope thats right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, well need a few things from your Elegoo Arduino kit. Ill list the items below. In this lesson were going to learn about the 4x4 Keypad Membrane Switch Module provided in the Elegoo kit. Ill step through the Elegoo provided code, which uses a Library, eight digital input pins, and explain how it makes this happen. Then I develop a circuit that uses a single analog input and a voltage ladder, without the need of a Library. I even include a spreadsheet to help calculate the resistor values used in the voltage ladder. Note the spreadsheet uses an Excel macro, its a harmless function to help determine minimum voltage spreads. Its unprotected so check out the code. Fun project, I hope you enjoy it. ## Parts youll need for the basic tutorial * Elegoo Arduino UNO R3 board * 4x4 Keypad Membrane Switch Module * Eight male-to-male jumpers ## Additional items needed * One 5K-ohm resistor * Four 2K-ohm resistors * Four 330-ohm resistors * Four 220-ohm resistors * Four 100-ohm resistors * Two 10-ohms resistors * 0.1 uF ceramic capacitor * Misc jumpers * Breadboard The next lesson will be Lesson ** 12 DHT11 Temperature and Humidity Sensor ** ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Sizeof function]( https://www.arduino.cc/reference/en/language/variables/utilities/sizeof/) * [HariFun #143 - How to read a 4x4 keypad using just one Arduino pin!](https://www.youtube.com/watch?v=G14tREsVqz0) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_05_-_Seas_of_Mars](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 12 - DHT11/DHT11_Decimal/DHT11_Decimal.ino ================================================ /*DHT11 Temperature and Humidity Sensor with Decimal values * By Ricardo Moreno * 02/13/208 * * Note: DHT11 does not return the decimal value * DHT21 and DHT22 does return the decimal value * * Original by * www.elegoo.com * 2016.12.9 * */ /* ****************** INCLUDE LIBRARIES ********************** */ #include // for DHT11, // VCC: 3.3V through 5.2V // GND: GND // DATA: 2 for example /* ******************* GLOBAL CONSTANTS ********************** */ // DHT11 data pin const int pinDHT11 = 2; SimpleDHT11 dht11; //instantiates the SimpleDHT11 Object class to variable dht11 /* ******************************************************* * Setup ********************************************************* */ void setup() { Serial.begin(9600); } /* ******************************************************* * Void Loop ********************************************************* */ void loop() { // start working... Serial.println("================================="); Serial.println("Sample DHT11..."); // read with raw sample data. //Local variables float temperatureC = 0.0; float temperatureF = 0.0; float humidity = 0.0; //Local data array byte data[40] = {0}; if (dht11.read2(pinDHT11, &temperatureC, &humidity, data)) { Serial.print("Read DHT11 failed"); return; } Serial.print("Sample RAW Bits: "); for (int i = 0; i < 40; i++) { Serial.print((int)data[i]); if (i > 0 && ((i + 1) % 4) == 0) { Serial.print(' '); } } Serial.println(""); //°F = °C x 9/5 + 32. temperatureF = temperatureC * 9.0/5.0 + 32.0; Serial.print("Sample OK: "); Serial.print(temperatureC); Serial.print("°C, "); Serial.print(temperatureF); Serial.print("°F, "); Serial.print(humidity); Serial.println("%"); // DHT11 sampling rate is 1HZ. delay(1000); } ================================================ FILE: Lesson 12 - DHT11/README.md ================================================ # ElegooTutorial ## Lesson 12 DHT11 Temperature and Humidity Sensor [YouTube video](https://youtu.be/rb95OWC6nGs) A beginner's guide to the Most Complete Starter Kit by Elegoo. ** Lesson 12 DHT11 Temperature and Humidity Sensor ** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 12 DHT11 Temperature and Humidity Sensor. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, well need a few things from your Elegoo Arduino kit. Ill list the items below. In this lesson were going to introduce the DHT11 Temperature and Humidity Sensor provided in the kit and the SimpleDHT Library. I step through the Elegoo provided code, which uses a Library, and explain how it makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then Ill discover the limitations of the DHT11 sensor and how to overcome it. As usual it was a fun project, I hope you enjoy it. ## Parts youll need for the basic tutorial * Elegoo Arduino UNO R3 board * The DHT11 Temperature and humidity Sensor * Three female-to-male jumper wires The next lesson will be ** Lesson 13 Analog Joystick Module ** ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [& Pointer Access Operators](https://www.arduino.cc/reference/en/language/structure/pointer-access-operators/reference/) * [adafruit DHTxx Sensor page](https://learn.adafruit.com/dht) [Connecting Sensor](https://learn.adafruit.com/dht/connecting-to-a-dhtxx-sensor) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_06_-_Haunted](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 13 - Analog Joystick Module/Analog_Joystick_OLEDcursor/Analog_Joystick_OLEDcursor.ino ================================================ /* Graphic crosshairs with analog joystick * by Ricardo Moreno * 03/15/2018 * */ /* ****************** INCLUDE LIBRARIES ********************** */ #include #include // ToneAC works on pins 9 and 10 /* ******************* GLOBAL CONSTANTS ********************** */ // Analog Joystick const PROGMEM int X_pin = A1; // analog pin connected to X output const PROGMEM int Y_pin = A0; // analog pin connected to Y output const PROGMEM int FIRE_BUT2 = 2; // digital pin connected to switch output //Tactile switch const PROGMEM int FIRE_BUT = A2; //Passive buzzer const PROGMEM byte spkr_pos = 9; const PROGMEM byte spkr_neg = 10; // OLED Pins // A byte can hold a number up to 255 const PROGMEM byte OLED_CLK = 13; //SCK system clock or SCL const PROGMEM byte OLED_MOSI = 11; //MOSI or SDA const PROGMEM byte OLED_RES = 8; //Reset const PROGMEM byte OLED_DC = 7; //Data Communication const PROGMEM byte OLED_CS = 6; //Component Select //Instantiate U8G2 object class - Plus Pins //There is only one small difference between SSD1306 and SH1106: The SH1106 controller has an internal RAM of 132x64 pixel //SSD1306 //U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI oled(U8G2_R0, /* clock=*/ OLED_CLK, /* data=*/ OLED_MOSI, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SSD1306_128X64_NONAME_2_4W_SW_SPI oled(U8G2_R0, /* clock=*/ OLED_CLK, /* data=*/ OLED_MOSI, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SSD1306_128X64_NONAME_F_4W_SW_SPI oled(U8G2_R0, /* clock=*/ OLED_CLK, /* data=*/ OLED_MOSI, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SSD1306_128X64_NONAME_2_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //SH1106 //U8G2_SH1106_128X64_NONAME_1_4W_SW_SPI oled(U8G2_R0, /* clock=*/ OLED_CLK, /* data=*/ OLED_MOSI, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SH1106_128X64_NONAME_2_4W_SW_SPI oled(U8G2_R0, /* clock=*/ OLED_CLK, /* data=*/ OLED_MOSI, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SH1106_128X64_NONAME_F_4W_SW_SPI oled(U8G2_R0, /* clock=*/ OLED_CLK, /* data=*/ OLED_MOSI, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SH1106_128X64_NONAME_1_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); //U8G2_SH1106_128X64_NONAME_2_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); const int MAXSCREEN_WIDTH PROGMEM = 128; //0-127 const int MAXSCREEN_HEIGHT PROGMEM = 64; //0-63 const int MAXANALOG_VALUE PROGMEM = 1023; //0-1023 /* ******************* GLOBAL VARIABLES ********************** */ int cursor_height = 20; int cursor_width = 20; int Xvalue = 512; int Yvalue = 512; bool Switchvalue = HIGH; /* ******************************************************* * Setup ********************************************************* */ void setup() { pinMode(FIRE_BUT2, INPUT_PULLUP); pinMode(FIRE_BUT, INPUT_PULLUP); //Serial.begin(9600); //OLED Diplay /* U8g2 Project: SSD1306 or SH1106 OLED SPI Board */ oled.begin(); oled.clear(); oled.setBitmapMode(1); } /* ******************************************************* * Void Loop ********************************************************* */ void loop() { if ((!digitalRead(FIRE_BUT))||(!digitalRead(FIRE_BUT2))){ Switchvalue = false; }else{ Switchvalue = true; } Xvalue = analogRead(X_pin); Yvalue = analogRead(Y_pin); //Serial.print("Switch: "); //Serial.print(Switchvalue); //Serial.print(" X-axis: "); //Serial.print(Xvalue); //Serial.print(" Y-axis: "); //Serial.println(Yvalue); //Serial.print("\n"); oled.clearBuffer(); draw(Xvalue, Yvalue, Switchvalue); oled.sendBuffer(); //delay(100); } /* ******************************************************* * Functions ********************************************************* */ void draw(int x, int y, bool sw){ x = map(x,MAXANALOG_VALUE,0,0,MAXSCREEN_WIDTH-1); y = map(y,0,MAXANALOG_VALUE,0,MAXSCREEN_HEIGHT-1); //Serial.print("X = "); Serial.print(x); Serial.print(" Y = "); Serial.println(y); //oled.drawVLine(x, y-cursor_height/2, cursor_height); oled.drawVLine(x,0,MAXSCREEN_HEIGHT-1); //oled.drawHLine(x-cursor_width/2, y, cursor_width); oled.drawHLine(0, y, MAXSCREEN_WIDTH-1); if (sw){ oled.drawCircle(x, y, 10, U8G2_DRAW_ALL); } else { //toneAC(frequency, volume, length , background) toneAC(600,5,200,true); oled.drawDisc(x, y, 10, U8G2_DRAW_ALL); } } ================================================ FILE: Lesson 13 - Analog Joystick Module/README.md ================================================ # ElegooTutorial ## Lesson 13 Analog Joystick Module [YouTube video](https://youtu.be/oFZuaBqEvlo) A beginner's guide to the Most Complete Starter Kit by Elegoo. ** Lesson 13 Analog Joystick Module ** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 13 Analog Joystick Module. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, well need a few things from your Elegoo Arduino kit. Ill list the items below. In this lesson were going to introduce the Analog Joystick Module provided in the kit. I step through the Elegoo provided tutorial and briefly explain how code and the Joystick makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. To show this functionality better, I add an OLED to show graphically the movement as a cross hairs on the display. I get a little sidetracked with another project and show a sneak preview of my next video. As usual it was a fun project, I hope you enjoy it. ## Parts youll need for the basic tutorial * Elegoo Arduino UNO R3 board * The Analog Joystick Module * Five female-to-male jumper wires The next lesson will be ** Lesson 14 IR Receiver Module ** ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [toneAC Library](https://bitbucket.org/teckel12/arduino-toneac/wiki/Home) * [U8g2 Library reference Wiki page](https://github.com/olikraus/u8g2/wiki/u8g2reference) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_07_-_Dory_Honey](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 14 - IR Receiver Module/IR_Receiver_Module/IR_Receiver_Module.ino ================================================ //www.elegoo.com //2016.12.9 #include "IRremote.h" /*-----( Global Constants )-----*/ const int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11 /*-----( Declare objects )-----*/ IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results' /*-----( Function )-----*/ void translateIR() { // takes action based on IR code received // describing Remote IR codes switch(results.value){ case 0xFFA25D: Serial.println("POWER"); break; case 0xFFE21D: Serial.println("FUNC/STOP"); break; case 0xFF629D: Serial.println("VOL+"); break; case 0xFF22DD: Serial.println("FAST BACK"); break; case 0xFF02FD: Serial.println("PAUSE"); break; case 0xFFC23D: Serial.println("FAST FORWARD"); break; case 0xFFE01F: Serial.println("DOWN"); break; case 0xFFA857: Serial.println("VOL-"); break; case 0xFF906F: Serial.println("UP"); break; case 0xFF9867: Serial.println("EQ"); break; case 0xFFB04F: Serial.println("ST/REPT"); break; case 0xFF6897: Serial.println("0"); break; case 0xFF30CF: Serial.println("1"); break; case 0xFF18E7: Serial.println("2"); break; case 0xFF7A85: Serial.println("3"); break; case 0xFF10EF: Serial.println("4"); break; case 0xFF38C7: Serial.println("5"); break; case 0xFF5AA5: Serial.println("6"); break; case 0xFF42BD: Serial.println("7"); break; case 0xFF4AB5: Serial.println("8"); break; case 0xFF52AD: Serial.println("9"); break; case 0xFFFFFFFF: Serial.println(" REPEAT");break; default: Serial.print(" other button "); Serial.println(results.value); }// End Case } //END translateIR void setup(){ /*----( SETUP: RUNS ONCE )----*/ Serial.begin(9600); Serial.println("IR Receiver Button Decode"); irrecv.enableIRIn(); // Start the receiver }/*--(end setup )---*/ void loop(){ /*----( LOOP: RUNS CONSTANTLY )----*/ if (irrecv.decode(&results)) // have we received an IR signal? { translateIR(); delay(500); // Do not get immediate repeat irrecv.resume(); // receive the next value } }/* --(end main loop )-- */ ================================================ FILE: Lesson 14 - IR Receiver Module/README.md ================================================ # ElegooTutorial ## Lesson 14 IR Receiver Module [YouTube video](https://youtu.be/CZ_mtpyXEFA) A beginner's guide to the Most Complete Starter Kit by Elegoo. Lesson 14 IR Receiver Module Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 14 IR Receiver Module. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to introduce the Infrared receiver module and the infrared remote provided in the kit. Ill step through the Elegoo provided tutorial and briefly explain how code and the IR receiver makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. With a small code change, we can discover other IR remote codes. As usual it was a fun project, I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * The IR Receiver Module * The IR Remote * Three female-to-male jumper wires The next lesson will be ** Lesson 15 MAX7219 LED Dot Matrix Module ** ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Guide to Infrared Communication by Andreas Spiess](https://www.youtube.com/watch?v=gADIb1Xw8PE) * [EEVblog #506 IR Remote Control Arduino Protocol Tutorial](https://www.youtube.com/watch?v=BUvFGTxZBG8) * [Arduino-IRremote](https://github.com/z3t0/Arduino-IRremote) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_01_-_Lift_Off](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 15 - MAX7219 Module/MyMarqueeText/MyMarqueeText.ino ================================================ #include // This sketch draw marquee text on your LED matrix using the hardware SPI driver Library by Bartosz Bielawski. // Example written 16.06.2017 by Marko Oette, www.oette.info // Define the ChipSelect pin for the led matrix (Dont use the SS or MISO pin of your Arduino!) // Other pins are arduino specific SPI pins (MOSI=DIN of the LEDMatrix and CLK) see https://www.arduino.cc/en/Reference/SPI const uint8_t LEDMATRIX_CS_PIN PROGMEM = 5; // Define LED Matrix dimensions (0-n) - eg: 32x8 = 31x7 const int LEDMATRIX_WIDTH PROGMEM = 7; const int LEDMATRIX_HEIGHT PROGMEM = 7; const int LEDMATRIX_SEGMENTS PROGMEM = 1; // The LEDMatrixDriver class instance LEDMatrixDriver lmd(LEDMATRIX_SEGMENTS, LEDMATRIX_CS_PIN); void setup() { // init the display lmd.setEnabled(true); lmd.setIntensity(2); // 0 = low, 10 = high } int x=0, y=0; // start top left // This is the font definition. You can use http://gurgleapps.com/tools/matrix to create your own font or sprites. // If you like the font feel free to use it. I created it myself and donate it to the public domain. byte font[95][8] = { {0,0,0,0,0,0,0,0}, // SPACE {0x10,0x18,0x18,0x18,0x18,0x00,0x18,0x18}, // EXCL {0x28,0x28,0x08,0x00,0x00,0x00,0x00,0x00}, // QUOT {0x00,0x0a,0x7f,0x14,0x28,0xfe,0x50,0x00}, // # {0x10,0x38,0x54,0x70,0x1c,0x54,0x38,0x10}, // $ {0x00,0x60,0x66,0x08,0x10,0x66,0x06,0x00}, // % {0,0,0,0,0,0,0,0}, // & {0x00,0x10,0x18,0x18,0x08,0x00,0x00,0x00}, // ' {0x02,0x04,0x08,0x08,0x08,0x08,0x08,0x04}, // ( {0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20}, // ) {0x00,0x10,0x54,0x38,0x10,0x38,0x54,0x10}, // * {0x00,0x08,0x08,0x08,0x7f,0x08,0x08,0x08}, // + {0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x08}, // COMMA {0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00}, // - {0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06}, // DOT {0x00,0x04,0x04,0x08,0x10,0x20,0x40,0x40}, // / {0x00,0x38,0x44,0x4c,0x54,0x64,0x44,0x38}, // 0 {0x04,0x0c,0x14,0x24,0x04,0x04,0x04,0x04}, // 1 {0x00,0x30,0x48,0x04,0x04,0x38,0x40,0x7c}, // 2 {0x00,0x38,0x04,0x04,0x18,0x04,0x44,0x38}, // 3 {0x00,0x04,0x0c,0x14,0x24,0x7e,0x04,0x04}, // 4 {0x00,0x7c,0x40,0x40,0x78,0x04,0x04,0x38}, // 5 {0x00,0x38,0x40,0x40,0x78,0x44,0x44,0x38}, // 6 {0x00,0x7c,0x04,0x04,0x08,0x08,0x10,0x10}, // 7 {0x00,0x3c,0x44,0x44,0x38,0x44,0x44,0x78}, // 8 {0x00,0x38,0x44,0x44,0x3c,0x04,0x04,0x78}, // 9 {0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00}, // : {0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x08}, // ; {0x00,0x10,0x20,0x40,0x80,0x40,0x20,0x10}, // < {0x00,0x00,0x7e,0x00,0x00,0xfc,0x00,0x00}, // = {0x00,0x08,0x04,0x02,0x01,0x02,0x04,0x08}, // > {0x00,0x38,0x44,0x04,0x08,0x10,0x00,0x10}, // ? {0x00,0x30,0x48,0xba,0xba,0x84,0x78,0x00}, // @ {0x00,0x1c,0x22,0x42,0x42,0x7e,0x42,0x42}, // A {0x00,0x78,0x44,0x44,0x78,0x44,0x44,0x7c}, // B {0x00,0x3c,0x44,0x40,0x40,0x40,0x44,0x7c}, // C {0x00,0x7c,0x42,0x42,0x42,0x42,0x44,0x78}, // D {0x00,0x78,0x40,0x40,0x70,0x40,0x40,0x7c}, // E {0x00,0x7c,0x40,0x40,0x78,0x40,0x40,0x40}, // F {0x00,0x3c,0x40,0x40,0x5c,0x44,0x44,0x78}, // G {0x00,0x42,0x42,0x42,0x7e,0x42,0x42,0x42}, // H {0x00,0x7c,0x10,0x10,0x10,0x10,0x10,0x7e}, // I {0x00,0x7e,0x02,0x02,0x02,0x02,0x04,0x38}, // J {0x00,0x44,0x48,0x50,0x60,0x50,0x48,0x44}, // K {0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7c}, // L {0x00,0x82,0xc6,0xaa,0x92,0x82,0x82,0x82}, // M {0x00,0x42,0x42,0x62,0x52,0x4a,0x46,0x42}, // N {0x00,0x3c,0x42,0x42,0x42,0x42,0x44,0x38}, // O {0x00,0x78,0x44,0x44,0x48,0x70,0x40,0x40}, // P {0x00,0x3c,0x42,0x42,0x52,0x4a,0x44,0x3a}, // Q {0x00,0x78,0x44,0x44,0x78,0x50,0x48,0x44}, // R {0x00,0x38,0x40,0x40,0x38,0x04,0x04,0x78}, // S {0x00,0x7e,0x90,0x10,0x10,0x10,0x10,0x10}, // T {0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e}, // U {0x00,0x42,0x42,0x42,0x42,0x44,0x28,0x10}, // V {0x80,0x82,0x82,0x92,0x92,0x92,0x94,0x78}, // W {0x00,0x42,0x42,0x24,0x18,0x24,0x42,0x42}, // X {0x00,0x44,0x44,0x28,0x10,0x10,0x10,0x10}, // Y {0x00,0x7c,0x04,0x08,0x7c,0x20,0x40,0xfe}, // Z // (the font does not contain any lower case letters. you can add your own.) }; // {}, // // Marquee speed const int ANIM_DELAY PROGMEM = 100; // Marquee text //char text[] = "** LED MATRIX DEMO! ** (1234567890) ++ \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" ++ <$%/=?'.@,> --"; char text[] = "** RICK THE TECH ENTHUSIAST VIDEOS! ** (1234567890) ++ \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" ++ <$%/=?'.@,> --"; int len = strlen(text); void loop() { // Draw the text to the current position drawString(text, len, x, 0); // In case you wonder why we don't have to call lmd.clear() in every loop: The font has a opaque (black) background... // Toggle display of the new framebuffer lmd.display(); // Wait to let the human read the display delay(ANIM_DELAY); // Advance to next coordinate if( --x < len * -8 ) x = LEDMATRIX_WIDTH; } /** * This function draws a string of the given length to the given position. */ void drawString(char* text, int len, int x, int y ) { for( int idx = 0; idx < len; idx ++ ) { int c = text[idx] - 32; // stop if char is outside visible area if( x + idx * 8 > LEDMATRIX_WIDTH ) return; // only draw if char is visible if( 8 + x + idx * 8 > 0 ) drawSprite( font[c], x + idx * 8, y, 8, 8 ); } } /** * This draws a sprite to the given position using the width and height supplied (usually 8x8) */ void drawSprite( byte* sprite, int x, int y, int width, int height ) { // The mask is used to get the column bit from the sprite row byte mask = B10000000; for( int iy = 0; iy < height; iy++ ) { for( int ix = 0; ix < width; ix++ ) { lmd.setPixel(x + ix, y + iy, (bool)(sprite[iy] & mask )); // shift the mask by one pixel to the right mask = mask >> 1; } // reset column mask mask = B10000000; } } ================================================ FILE: Lesson 15 - MAX7219 Module/README.md ================================================ # ElegooTutorial ## Lesson 15 MAX7219 LED Dot Matrix Module [YouTube video](https://youtu.be/iqeSlA8vYRA) Lesson 15: MAX7219 LED Dot Matrix Module. Simple sketch provided in the Elegoo tutorial, using LEDControl and LEDMatrixDriver libraries. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 15 MAX7219 LED Dot Matrix Module. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the MAX7219 LED Dot Matrix Module provided in the kit. Ill step through the Elegoo provided tutorial and briefly explain how code makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. The sketch used a software SPI driven Library, and then well install a hardware SPI library and see some of the differences. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * The MAX7219 LED Dot Matrix Module * Five female-to-male jumper wires The next lesson will be Lesson 16: GY-521 Module. ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * [SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background](https://www.amazon.com/gp/product/B071Y6JX3H/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B071Y6JX3H&linkCode=as2&tag=rmorenojr-20&linkId=81e6c312179be2b149bf6eeae0051f14) * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [LED Control explanation](http://playground.arduino.cc/Main/LedControl) * [LedControl Library](https://github.com/wayoda/LedControl) * [LEDMatrixDriver Library](https://github.com/bartoszbielawski/LEDMatrixDriver) * [Arduino tutorial: LED Matrix red 8x8 64 Led driven by MAX7219 (or MAX7221) and Arduino Uno](https://www.youtube.com/watch?v=TOuKnOG8atk) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_01_-_Shake_It](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 16 - GY-521 Module/MPU-6050_expanded/MPU-6050_expanded.ino ================================================ /* *********************************************************** * MPU-6050 expanded tutorial sketch - v1.0 * Uses the Wire.h library * the GY-521 Module * The Arduino UNO R3 * Modified by Ricardo Moreno * May 08, 2018 * * Inspired by Elegoo Lesson 16 and EEEthusiast * Ep. 57 Arduino Accelerometer & Gyroscope Tutorial MPU-6050 6DOF Module * Website: http://eeenthusiast.com/ * video: https://www.youtube.com/watch?v=M9lZ5Qy5S2s&t=0 * Sketch: https://github.com/VRomanov89/EEEnthusiast/tree/master/MPU-6050%20Implementation/MPU6050_Implementation * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * History: * 05/08/2018 V1.0 - Initial release */ /* *********************************************************** * Library * * ********************************************************* */ #include /* *********************************************************** * Global Constants * * ********************************************************* */ const int MPU_addr=0x68; // I2C address of MPU-6050 /* I2C address can be found in the datasheet Section 9.2 I2C Interface Depending if AD0 is set to HIGH or LOW results in different address: PIN Binary Hex Dec | AD0 HIGH | b1101001 | 0x69 | 105 | | AD0 LOW | b1101000 | 0x68 | 104 | */ /* *********************************************************** * Global Variables * * ********************************************************* */ // unsigned long = 32 bits // unsigned int = 16 bits int16_t AcX, AcY, AcZ; //accelerometer - force it to be a 16-bit integer float gForceX, gForceY, gForceZ; int AcRange = 0; //accelerometer Range at the cost of Sensitivity - see setupMPU //values 0, 1, 2, 3 int16_t GyX, GyY, GyZ; //gyroscope - force it to be a 16-bit integer float rotX, rotY, rotZ; int GyRange = 0; //gyroscope Range at the cost of Sensitivity - see setupMPU //values 0, 1, 2, 3 float Tmp; //temperature int loopDelay = 333; /* *********************************************************** * Void Setup * * ********************************************************* */ void setup() { Serial.begin(9600); Wire.begin(); setupMPU(); } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop() { recordAccel(); recordTemperature(); recordGyro(); printData(); delay(loopDelay); } /* *********************************************************** * Functions * * ********************************************************* */ void setupMPU(){ /* ********************************************************* This function consists of three parts: Sets the MPU-6050 Power Management Device reset, sleep mode, cycle mode, and Temperature disable bits to zero Sets Accelerometer sensitivity Sets Gyroscope Sensitivity Could be called again if a change in sensitivty is desired */ //Local Variable byte c; //byte should be a unsigned 8-bit value byte buffer[1]; /* ********************* * PWR_MGMT_1 * ********************* */ /* Power Management Section 4.28 in Register Map Datasheet. Since the MPU-6050 powers up in sleep mode, we'll need to wake it. Register Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 | 6B |Device | Sleep | Cycle | - | Temp | CLKSEL | | | Reset | | | |Disable| (clock source) | -->Page 9 (in section 4) see Note: The device will come up in sleep mode upon power-up. */ readFrom(0x6B,1,buffer); c = buffer[1] & 0x07; //Registry Value AND with 0b00000111 zeros bits 7,6,5,4 & 3 writeTo(0x6B,c); //Then we set the bits to zero and keep the clock source bits the same //OR writeTo(0x6B,0); //Caution: this will also set the clock source to zero - which in this case is ok // if you didn't want to change the clock source (example using an external clock) // use a method like above. /* ********************* * GYRO_CONFIG * ********************* */ /* Gyroscope Configuration Section 4.4 in Register Map Datasheet full scale range: ±250, ±500, ±1000, ±2000°/sec Register Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 | 1B | XG_ST | YG_ST | ZG_ST |Full Scale Range| - | - | - | | | | | | Select FS_SEL | | | | (Setting XG_ST,TG_ST and ZG_ST to 1 will perform a self test) Section 4.19 Gyroscope Measurements: FS_SEL Binary Full Scale Range | 0 | 0 | ±250°/sec | | 1 | 1000 | ±500°/sec | | 2 | 10000 | ±1000°/sec | | 3 | 11000 | ±2000°/sec | -->Note: FS_SEL/360*60sec/min = RotationValue in RPM Sensitivity decreases with larger range. */ switch (GyRange){ //GyRange set in Global Variables above case 0: writeTo(0x1B,0x0); //Set GYRO_CONFIG to FS_SEL ±250°/sec break; case 1: writeTo(0x1B,0x8); //Set GYRO_CONFIG to FS_SEL ±500°/sec break; case 2: writeTo(0x1B,0x10); //Set GYRO_CONFIG to FS_SEL ±1000°/sec break; case 3: writeTo(0x1B,0x18); //Set GYRO_CONFIG to FS_SEL ±2000°/sec break; default: writeTo(0x1B,0x0); //Set GYRO_CONFIG to FS_SEL ±250°/sec } /* ********************* * ACCEL_CONFIG * ********************* */ /* Accelerometer Configuration Section 4.5 in the Register Map datasheet full scale range: ±2g, ±4g, ±8g, and ±16g Register Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 | 1C | XA_ST | YA_ST | ZA_ST |Full Scale Range| - | - | - | | | | | | Select AFS_SEL | | | | (Setting XA_ST,TA_ST and ZA_ST to 1 will perform a self test) Section 4.17 AFS_SEL Binary Full Scale Range | 0 | 0 | ±2g | | 1 | 1000 | ±4g | | 2 | 10000 | ±8g | | 3 | 11000 | ±16g | */ switch (AcRange) { //AcSensitivity set in Global Variables above case 0: writeTo(0x1C,0x0); //Set ACCEL_CONFIG to AFS_SEL ±2g break; case 1: writeTo(0x1C,0x8); //Set GYRO_CONFIG to AFS_SEL ±4g break; case 2: writeTo(0x1C,0x10); //Set GYRO_CONFIG to AFS_SEL ±8g break; case 3: writeTo(0x1C,0x18); //Set GYRO_CONFIG to AFS_SEL ±16g break; default: writeTo(0x1C,0x0); //Set GYRO_CONFIG to AFS_SEL ±2g } } void writeTo(byte toAddress, byte value) { /* ********************************************************* Generic Wire.write() registry byte routine toAddress - registry location value value - numeric byte value */ Wire.beginTransmission(MPU_addr); // This begins the I2C communication to the MPU Wire.write(toAddress); // Access the register Wire.write(value); // Set the byte value to register above Wire.endTransmission(true); // Close I2C communication } void readFrom(byte fromAddress, int num, byte results[]){ /* ********************************************************* Generic Wire.read() registry byte routine fromAddress - registry location value num - number of bytes results[] - array to store byte values */ Wire.beginTransmission(MPU_addr); //I2C address of the MPU Wire.write(fromAddress); //Starting register for Readings Wire.endTransmission(false); //This resent the request and holds the MPU for exclusive communication Wire.requestFrom(MPU_addr,num,true); //Request num Registers bytes and releases I2C int i = 0; while(Wire.available()) { results[i] = Wire.read(); //Stores values in buffer arrray i++; } } void recordAccel() { /* ********************************************************* Section 4.17 Accelerometer Measurements Registers 3B - 40 Note the values are broken up into High and Low bytes so we must store the first value and shift it 8 bits over and OR it with the second value to form the 16 bit value. */ //Local Variable byte buffer[6]; readFrom(0x3B,6,buffer); AcX = buffer[0]<<8|buffer[1]; //Store two bytes 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L) //AcX = buffer[0]*256+buffer[1]; // OR you could also do this AcY = buffer[3]<<8|buffer[4]; //Store two bytes 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L) AcZ = buffer[5]<<8|buffer[6]; //Store two bytes 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L) processAccelData(); } void processAccelData(){ /* ********************************************************* Section 4.17 Accelerometer Measurements AFS_SEL Binary Full Scale Range LSB Sensitity | 0 | 0 | ±2g | 16384 LSB/g | | 1 | 1 | ±4g | 8192 LSB/g | | 2 | 10 | ±8g | 4096 LSB/g | | 3 | 11 | ±16g | 2048 LSB/g | --> g force in direction = AcX/LSB Sensitivity */ //Local Variable float LSB; switch (AcRange){ case 0: LSB = 16384.0; //AFS_SEL ±2g break; case 1: LSB = 8192.0; //AFS_SEL ±4g break; case 2: LSB = 4096.0; //AFS_SEL ±8g break; case 3: LSB = 2048.0; //AFS_SEL ±16g break; default: LSB = 16384.0; //AFS_SEL ±2g } gForceX = (float)(AcX) / LSB; gForceY = (float)(AcY) / LSB; gForceZ = (float)(AcZ) / LSB; } void recordTemperature() { /* ********************************************************* Section 4.18 Temperature Measurement The scale factor and offset for the temperature sensor are found in the Electrical Specifications table (Section 6.3 of the MPU-6000/MPU-6050 Product Specification document). Range = -40 to +85 Sensitivity = 340 Temperature offset = -521 at 35°C = B1111110111110111 therfore: C = (RawData - offest)/340 = RawData/340 - offset/340 offset = -521-(340*35) = -12412 C = RawData/340 - (-12412)/340 = RawData/340 + 36.51 (that's funny, equation provided shows 36.53) Note: the measurement is stored as a signed 16-bit number */ //Local Variable byte buffer[2]; int rTmp; //Raw temperature Temperature number signed integer readFrom(0x41,2,buffer); rTmp=buffer[0]<<8|buffer[1]; //Stores two bytes 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L) Tmp = (float)rTmp/340.00 + 36.53; //equation for temperature in degrees C from datasheet } void recordGyro() { /* ********************************************************* Section 4.19 Gyroscope Measurements Registers 0x43 - 0x48 Note the values are broken up into High and Low bytes so we must store the first value and shift it 8 bits over and OR it with the second value to form the 16 bit value. */ //Local Variable byte buffer[6]; readFrom(0x43,6,buffer); //Request Gyro Registers (43 - 48) GyX = buffer[0]<<8|buffer[3]; //Store two bytes 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L) GyY = buffer[3]<<8|buffer[4]; //Store two bytes 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L) GyZ = buffer[5]<<8|buffer[6]; //Store two bytes 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L) processGyroData(); } void processGyroData() { /* ********************************************************* Section 4.19 Gyroscope Measurements: FS_SEL Binary Full Scale Range LSB Sensitity | 0 | 0 | ±250°/s | 131.0 LSB/°/s | | 1 | 1 | ±500°/s | 65.5 LSB/°/s | | 2 | 10 | ±1000°/s | 32.8 LSB/°/s | | 3 | 11 | ±2000°/s | 16.4 LSB/°/s | --> rotation force in direction = GyX/LSB Sensitivity Note that the measurement stored is a 16-bit 2's complement value */ //Local Variable float LSB; switch (GyRange){ case 0: LSB = 131.0; //FS_SEL ±250°/s break; case 1: LSB = 65.5; //FS_SEL ±500°/s break; case 2: LSB = 32.8; //FS_SEL ±1000°/s break; case 3: LSB = 16.4; //FS_SEL ±2000°/s break; default: LSB = 131.0; //FS_SEL ±250°/s } rotX = (float)(GyX) / LSB; rotY = (float)(GyY) / LSB; rotZ = (float)(GyZ) / LSB; } void printData() { /* ********************************************************* Print the output to the serial monitor */ Serial.print("Gyro (deg)"); Serial.print(" X="); Serial.print(rotX); Serial.print(" Y="); Serial.print(rotY); Serial.print(" Z="); Serial.print(rotZ); Serial.print("\t"); // prints a tab Serial.print("Accel (g)"); Serial.print(" X="); Serial.print(gForceX); Serial.print(" Y="); Serial.print(gForceY); Serial.print(" Z="); Serial.print(gForceZ); Serial.print("\t"); // prints a tab Serial.print(" Temp="); Serial.println(Tmp); } ================================================ FILE: Lesson 16 - GY-521 Module/README.md ================================================ # ElegooTutorial ## Lesson 16 GY-521 Module & MPU-6050 [![YouTube video](https://img.youtube.com/vi/y5X2zwbO6e4/0.jpg)](https://youtu.be/y5X2zwbO6e4) [YouTube video](https://youtu.be/y5X2zwbO6e4) GY-521-Module & MPU-6050. Demonstrate the Elegoo sketch provided in the tutorial covering the GY-521-Module which uses a 6-axis, 6 DOF, MEMS MPU-6050. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the GY-521 Module. Ill step through the Elegoo provided tutorial and briefly explain how code makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. The sketch uses Wire.h Library and I2C to communicate to the module. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * GY-521 Module * Four or five female-to-male jumper wires The next lesson will be Lesson 17: HC-SR501 PIR Sensor ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Wire.requestFrom()](https://www.arduino.cc/en/Reference/WireRequestFrom) * [Wire.read()](https://www.arduino.cc/en/Reference/WireRead) * [Wire.write()](https://www.arduino.cc/en/Reference/WireWrite) * [Wire.beginTransmission()](https://www.arduino.cc/en/Reference/WireBeginTransmission) * [Wire.endTransmission()](https://www.arduino.cc/en/Reference/WireEndTransmission) * [Wire.requestFrom()](https://www.arduino.cc/en/Reference/WireRequestFrom) * [Wire.available()](https://www.arduino.cc/en/Reference/WireAvailable) * [TDK InvenSense MPU-6000 and MPU-6050](https://www.invensense.com/products/motion-tracking/6-axis/mpu-6050/) * [Ep. 57 Arduino Accelerometer & Gyroscope Tutorial MPU-6050 6DOF Module by EEEnthusiast](https://www.youtube.com/watch?v=M9lZ5Qy5S2s) * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_01_-_What](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 17 - HC-SR501/HC-SR501_Demo/HC-SR501_Demo.ino ================================================ /* *********************************************************** * HC-SR501 Motion Sensor Demonstration * Uses the HC-SR501 PIR Sensor * Modified by Ricardo Moreno * June 23, 2018 * * Inspired by Elegoo Lesson 17 and DroneBot * Motion Sensor with Delay * DroneBot Workshop 2018 * https://dronebotworkshop.com * * Note: Set the sensor for 3-second trigger * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * History: * 06/23/2018 V1.0 - Initial release */ /* *********************************************************** * Global Constants * * ********************************************************* */ // Set the Arduino pins const int detectedLED = 10; // Blue LED Pin const int readyLED = 9; // Green LED Pin const int waitLED = 8; // Red LED Pin const int pirPin = 7; // Input from Motion Sensor const int BuzzerPin = 11; // Active buzzer pin //Set Detection Constants for Different States const int TRIGGERED = 2; const int READY = 1; const int WAIT = 0; //Set Constant DELAY or ON times here const int BuzzerOnTime = 500; // Active Buzzer time const int dotLength = 40; // Number of progress dots max per row const unsigned int initialDelay = 60000; // Initial startup delay const unsigned int divisor = 40000; // Period of time between progress periods /* *********************************************************** * Global Variables * * ********************************************************* */ bool BuzzerOnState = false; // Buzzer State int pirValue; // PIR Output value int pirState; // Stores the PIR State unsigned long triggeredStartTime; // Stores Start time unsigned long waitStartTime; // Stores Wait Start time - // when output pin switches from High to Low unsigned int timeDelay; // Time delay - // manually adjust time delay to 3 seconds // software recorded unsigned int waitDelay = 7000; // Wait delay is after time delay - // software adjusted /* *********************************************************** * Void Setup * * ********************************************************* */ void setup(){ Serial.begin(9600); /* Setup PinModes */ // LEDs as Outputs pinMode(detectedLED, OUTPUT); pinMode(readyLED, OUTPUT); pinMode(waitLED, OUTPUT); // Buzzer as Outputs pinMode(BuzzerPin, OUTPUT); // PIR as Input pinMode(pirPin, INPUT); /* Initial 1 Minute Delay to stabilize sensor */ Serial.println("Wait one minute to stabilize sensor"); showLEDs(WAIT); // Make progress trailing dots for (int i=0; i<= initialDelay/400; i++){ //This loop makes the trailing dots across the screen. if ((i%(dotLength-5)==0)&&(i>0)&&(i==(dotLength-5))){ //First Line Serial.println("."); } else if (((i-(dotLength-5))%dotLength==0)&&(i>(dotLength-4))){ //Lines after Serial.println("."); } else { Serial.print("."); } delay(400); } showLEDs(READY); } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop(){ static int i; switch (pirState){ case READY: pirValue = digitalRead(pirPin); if (pirValue) { pirTriggered(); i=0; } break; case TRIGGERED: /* NOTE: While triggered, PIR output will remain high until time delay is passed. If repeatable trigger mode is enabled, it will reset the time delay. At this point, the Arduino cannot do anything but monitor the output */ // Make progress trailing dots if (i%divisor==0) {Serial.print(".");} //Check for Low PIR value pirValue = digitalRead(pirPin); if (!pirValue) { //times up /* Wait time begins */ waitStartTime = millis(); timeDelay = waitStartTime-triggeredStartTime; // Records the actual time delay Serial.print("timeDelay = "); Serial.print(timeDelay); Serial.println("ms"); showLEDs(WAIT); i=0; } //Check Buzzer if ((BuzzerOnState)&&((millis()-triggeredStartTime)>= BuzzerOnTime)){ BuzzerOnState = false; digitalWrite(BuzzerPin, LOW); } i++; break; case WAIT: // Make progress trailing dots if (i%divisor==0) {Serial.print(".");} // Check time > waitDelay if ((millis()-waitStartTime)>= waitDelay) { Serial.print("waitDelay = "); Serial.print(waitDelay); Serial.println("ms"); showLEDs(READY); i=0; } /* NOTE: Since PIR hardware is not controlled by the Arduino, wait delay is approximate. If early motion detection is discovered, quickly record the new value and switch states */ pirValue = digitalRead(pirPin); if (pirValue) { // Autocorrection Routine: // record new wait delay and jump to Triggered State waitDelay = millis()-waitStartTime; Serial.println("PreTriggered!"); Serial.print("Autocorrecting waitDelay = "); Serial.print(waitDelay); Serial.println("ms"); pirTriggered(); //Turn on Triggered LED and switch to Triggered State i=0; } i++; break; default: // do nothing break; } } /* *********************************************************** * Functions * * ********************************************************* */ void pirTriggered(){ /* This Subroutine switches on all the things that need * to happen during a triggered event. */ triggeredStartTime = millis(); // Record Triggered Start Time showLEDs(TRIGGERED); // Show Triggered LED digitalWrite(BuzzerPin, HIGH); // Enable Buzzer BuzzerOnState = true; // Enable Buzzer State Serial.print("Measuring Delay."); } void showLEDs(int value){ pirState = value; switch (value){ case WAIT: //WAIT Serial.print("Wait"); // to be followed by progress dots digitalWrite(detectedLED, LOW); digitalWrite(readyLED, LOW); digitalWrite(waitLED, HIGH); break; case READY: //READY Serial.println("Ready"); digitalWrite(detectedLED, LOW); digitalWrite(readyLED, HIGH); digitalWrite(waitLED, LOW); break; case TRIGGERED: //TRIGGERED Serial.println("Triggered!"); digitalWrite(detectedLED, HIGH); digitalWrite(readyLED, LOW); digitalWrite(waitLED, LOW); break; default: // Maybe add error code here // do nothing break; } } ================================================ FILE: Lesson 17 - HC-SR501/README.md ================================================ # ElegooTutorial ## Lesson 17 HC-SR501 PIR Sensor [![YouTube video](https://img.youtube.com/vi/y5X2zwbO6e4/0.jpg)](https://youtu.be/Fx_dQNpZ-x4) [YouTube video](https://youtu.be/Fx_dQNpZ-x4) HC-SR501 PIR Sensor. Demonstrate the Elegoo sketch provided in the tutorial covering the HC-SR501 PIR Sensor and expand the sketch to include LED and buzzer. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the HC-SR501 Passive Infra-Red Sensor. Ill step through the Elegoo provided tutorial and briefly explain how code makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then will expand the sketch to include LED to indicate the PIR state and a buzzer for audio confirmation. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * HC-SR501 PIR Sensor * Three female-to-male jumper wires The next lesson will be Lesson 18: Water Level Detection Sensor Module ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [HC-SR501 PIR Motion Detector - With Arduino & Raspberry Pi by DroneBot Workshop](https://www.youtube.com/watch?v=ZC_sEW3_694) * [Using the HC-SR501 PIR Motion Sensor With Arduino & Raspberry Pi](https://dronebotworkshop.com/using-pir-sensors-with-arduino-raspberry-pi/) * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [OldSchoolFinalMix](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 18 - Water Level Detection Sensor Module/README.md ================================================ # ElegooTutorial ## 18 Water Level Detection Sensor Module [![YouTube video](https://img.youtube.com/vi/y5X2zwbO6e4/0.jpg)](https://youtu.be/J_QNCmBe20o) [YouTube video](https://youtu.be/J_QNCmBe20o) Water Level Detection Sensor Module. Demonstrate the Elegoo sketch provided in the tutorial covering the Water Level Detection Sensor Module and provide a few improvements. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the Water Level Detection Sensor Module. Ill step through the Elegoo provided tutorial and briefly explain how code makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then Ill expand the sketch to include additional functionality and readability. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * Water Level Detection Sensor Module * Three female-to-male jumper wires The next lesson will be Lesson 19: Real Time Clock Module ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [HC-SR501 PIR Motion Detector - With Arduino & Raspberry Pi by DroneBot Workshop](https://www.youtube.com/watch?v=ZC_sEW3_694) * [Why most Arduino Soil Moisture Sensors suck (incl. solution) by Andreas Spiess](https://www.youtube.com/watch?v=udmJyncDvw0) * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 18 - Water Level Detection Sensor Module/Water_level/Water_level.ino ================================================ /* *********************************************************** * Water Level * Uses the Water Level Detection Sensor Module * Modified by Ricardo Moreno * July 11, 2018 * * Original sketch by: * www.elegoo.com * 2016.12.9 */ /* *********************************************************** * Global Constants * * ********************************************************* */ const int sensorPin = A0; // using alias for analog pin 0 // analog alias A0-A5 input pins = D14-D19 bool tapWater = true; // Boolean if using plain tap water /* *********************************************************** * Global Variables * * ********************************************************* */ int HistoryValue = 0; //char printBuffer[20]; // Make sure to adjust array value if you change the string //char printBuffer[30]; // Make sure to adjust array value if you change the string char printBuffer[45]; // Make sure to adjust array value if you change the string String analogPin; /* *********************************************************** * Void Setup * * ********************************************************* */ void setup() { Serial.begin(9600); analogPin = analogPinConverter(sensorPin); } int levelConverter(int sensorValue, bool isCleanWater = true){ int percentage; static int maxValue = 350; if (isCleanWater){ percentage = map(sensorValue, 0, maxValue, 0, 100); if (percentage > 100) { maxValue = sensorValue; percentage = 100; } }else{ percentage = map(sensorValue, 0, 1023, 0, 100); } return percentage; } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop() { int currentValue = analogRead(sensorPin); // get sensorPin analog value int diffValue = HistoryValue - currentValue; if((abs(diffValue) >= 10)||((currentValue == 0)&&(HistoryValue != 0))) { int percentValue = levelConverter(currentValue, tapWater); //[original] sprintf(printBuffer,"ADC%d level is %d\n",adc_id, value); // sprintf(printBuffer,"PIN %03d level is %04d\n", sensorPin, currentValue); // sprintf(printBuffer,"PIN %s level is %04d)\n", analogPin.c_str(), currentValue); sprintf(printBuffer,"PIN %s level is %03d%% (raw value is %04d)\n", analogPin.c_str(), percentValue, currentValue); Serial.print(printBuffer); HistoryValue = currentValue; } } String analogPinConverter(int value){ String analogPinValue; switch(value){ case 14: // D14 = A0 analogPinValue = "A0"; break; case 15: // D15 = A1 analogPinValue = "A1"; break; case 16: // D16 = A2 analogPinValue = "A2"; break; case 17: // D17 = A3 analogPinValue = "A3"; break; case 18: // D18 = A4 analogPinValue = "A4"; break; case 19: // D19 = A5 analogPinValue = "A5"; break; default: analogPinValue = "Pin Error"; break; } return analogPinValue; } ================================================ FILE: Lesson 19 - Real Time Clock Module/README.md ================================================ # ElegooTutorial ## 19 Real Time Clock Module [![YouTube video](https://img.youtube.com/vi/y5X2zwbO6e4/0.jpg)](https://youtu.be/h-EZ0KSqqw0) [YouTube video](https://youtu.be/h-EZ0KSqqw0) ZS-042 Module aka. DS3231 RTC Module with AT24C32N EEprom chip and CR2032 battery. Demonstrate the Elegoo sketch provided in the tutorial covering the DS3231 RTC Module. Then I show my RTC alarm clock with my custom SimpleAlarmClock Library. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the DS3231 RTC module, aka. ZS-042 module. The ZS-042 module includes a DS3231 real time clock and calendar, AT24C32N EEPROM chip, and CR2032 battery. Ill step through the Elegoo provided tutorial and briefly explain how code makes this happen. Well build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then will show an alarm clock circuit, complete with snooze alarm, and new SimpleAlarmClock.h library. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * ZS-042 Module (aka. DS3231 RTC Module) * Four female-to-male jumper wires The next lesson will be Lesson 20: Sound Sensor Module ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [HC-SR501 PIR Motion Detector - With Arduino & Raspberry Pi by DroneBot Workshop](https://www.youtube.com/watch?v=ZC_sEW3_694) * [Why most Arduino Soil Moisture Sensors suck (incl. solution) by Andreas Spiess](https://www.youtube.com/watch?v=udmJyncDvw0) ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) * Royalty Free Music from "Constance" Kevin MacLeod - [Welcome to the Show]( https://incompetech.com/music/royalty-free/music.html) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 19 - Real Time Clock Module/RTC_Alarm/RTC_Alarm.ino ================================================ /* *********************************************************** * RTC_Alarm sketch - v1.0 * Uses the ZS-040 module, aka DS3231 RTC module * Uses the SimpleAlarmClock.h library by Ricardo Moreno * Uses the LiquidCrystal.h library * Uses the Button.h library by Alexander Brevig & Ricardo Moreno * Uses the pitches.h library * November 25, 2018 * * Inspired by Elegoo Lesson 19 and Simple Projects' * Arduino real time clock with alarm and temperature monitor * using DS3231 and AT24C32 found on ZS-40 module * https://tinyurl.com/y8br3og2 * Impliments an alarm clock on a 16x2 LCD Display with * Three tact switches, DS3231 module, LED and passive buzzer. * * Description: * This sketch illustrates the SimpleAlarmClock library with * DS3231 Real Time Clock and AT24C32 EEPROM. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * History: * 11/25/2018 v1.0 - Initial release * * ********************************************************* */ /* *********************************************************** * Libraries * * ********************************************************* */ #include // https://github.com/rmorenojr/SimpleAlarmClock #include #include // https://github.com/rmorenojr/Button #include /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ //LiquidCrystal(rs, enable, d4, d5, d6, d7) LiquidCrystal lcd(3, 4, 5, 6, 7, 8); // instantiates the LiquiCrystal // Object class to variable lcd const byte RTC_addr=0x68; // I2C address of DS3231 RTC const byte EEPROM_addr=0x57; // I2C address of AT24C32N EEPROM const bool INTCN = true; // allows SQW pin to be monitored /* I2C address can be found in the datasheet Figure 1. Device Address ZS-040 module has pull-up resistors on these pins giving them a default value of 1. Shorting an individual pad results in different address: pads Binary Hex Dec | Default | b1101111 | 0x57 | 87 | | short A0 | b1101110 | 0x56 | 86 | | short A1 | b1101101 | 0x55 | 85 | | short A2 | b1101011 | 0x53 | 83 | | All Short| b1101000 | 0x50 | 80 | allowing up to eight combinations */ // instantiate SimpleAlarmClock SimpleAlarmClock Clock(RTC_addr, EEPROM_addr, INTCN); const int Snooze_Pin = 11; const int Lt_Pin = 9; const int Rt_Pin = 10; const int DebouceTime = 30; // button debouce time in ms Button SnoozeKey(Snooze_Pin, BUTTON_PULLUP_INTERNAL, true, DebouceTime); Button LtKey(Lt_Pin, BUTTON_PULLUP_INTERNAL, true, DebouceTime); Button RtKey(Rt_Pin, BUTTON_PULLUP_INTERNAL, true, DebouceTime); const int LED_Pin = 13; // digital pin for LED const int BUZZER_Pin = 12; // digital pin for tone buzzer const int SQW_Pin = 2; // Interrrupt pin const int Button_Hold_Time = 3000; // button hold length of time in ms const int Alarm_View_Pause = 2000; // View Alarm Length of time in ms const byte SnoozePeriod = 9; // Snooze value, in minutes const int flashInterval = 1000; // Alarm flashing interval const int SkipClickTime = 60; // Time in ms to ignore button click //Alarm types: const byte Daily=0; const byte Weekday=1; const byte Weekend=2; const byte Once=3; //Clock Modes: const byte AMhr=0; const byte PMhr=1; const byte M24hr=2; //Clocks const byte clock0=0; const byte alarm1=1; const byte alarm2=2; /* *********************************************************** * Global Variables * * ********************************************************* */ // notes in the melody: int melody[] = { //NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 NOTE_C6, NOTE_C6, NOTE_C6, NOTE_C6, NOTE_C6, }; // note durations: 4 = quarter note, 8 = eighth note, etc.: //int noteDurations[] = { 4, 8, 8, 4, 4, 4, 4, 4 }; int noteDurations[] = { 16, 16, 16, 16, 16 }; enum States { PowerLoss, ShowClock, ShowAlarm1, ShowAlarm2, Alarm, EditClock, EditAlarm1, EditAlarm2 }; States ClockState = ShowClock; States PrevState = EditAlarm2; // Used for debugging byte HourType = 0; // 0=AM/PM, 1=24hour - used in display alarm - to be deleted bool Fahrenheit = true; // Or Celsius=false bool PrevFahrenheit = Fahrenheit; // Capture previous Fahrenheit float CurrentTemperature; // Maybe move as static variable under displayClock function unsigned long RunTime; // Used to track time between get temperature value unsigned long buttonHoldPrevTime = 0.0; // Used to track button hold times unsigned long AlarmRunTime; DateTime PreviousTime; // Maybe move as static variable under displayClock function AlarmTime PreviousAlarm; // Maybe move as static variable under displayAlarm function byte EditHourType = 0; // 0=AM, 1=PM, 2=24hour - used for edit only byte cpIndex = 0; // Cursor Position Index - used for edit mode byte ActiveAlarms = 0; // used to store active alarms (not enabled alarms) bool bHoldButtonFlag = false; // used to prevent holdButton also activating clickButton bool bDisplayStatus = true; // used to track the lcd display on status //custom LCD characters: https://omerk.github.io/lcdchargen/ //Up arrow byte cA1[8] = { 0b00100, 0b01110, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000 }; //Down arrow byte cA2[8] = { 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b01110, 0b00100 }; //Both arrows byte cBA[8] = { 0b00100, 0b01110, 0b11111, 0b00000, 0b00000, 0b11111, 0b01110, 0b00100 }; //Skinny letter A byte cSA[8] = { 0b00000, 0b00010, 0b00111, 0b00101, 0b00111, 0b00101, 0b00101, 0b00000 }; /* *********************************************************** * Functions * * ********************************************************* */ void displayClock(bool changeFlag=false) { /* ***************************************************** * * Display clock - skips update if there are no changes * * Parameters: * changeFlag - true forces display refresh * - false does nothing * ***************************************************** */ DateTime NowTime; //create DateTime struct from Library NowTime = Clock.read(); // get the latest clock values // CheckFlag Section: // The DS3231 temperature can be read once every 64 seconds. // Check the temperature every 65 seconds OR // Check the temperature if Fahrenheit changes unsigned long uL = millis() - RunTime; if ((uL >=65000)||(Fahrenheit != PrevFahrenheit)) { float PreviousTemperature = CurrentTemperature; CurrentTemperature = getTemperatureValue(); RunTime = millis(); PrevFahrenheit = Fahrenheit; if (CurrentTemperature != PreviousTemperature) {changeFlag = true;} } // Check for Time change if (NowTime.Hour != PreviousTime.Hour){ changeFlag = true; } if (NowTime.Minute != PreviousTime.Minute){ changeFlag = true; } if (NowTime.ClockMode != PreviousTime.ClockMode) { changeFlag = true; } if (NowTime.Day != PreviousTime.Day) { changeFlag = true; } if (NowTime.Month != PreviousTime.Month) { changeFlag = true; } if (NowTime.Year != PreviousTime.Year) { changeFlag = true; } //Update Display - Only change display if change is detected if (changeFlag == true){ lcd.clear(); //First Row hh:mm AM ###.#°F lcd.setCursor(0,0); //Column, Row lcd.print(p2Digits(NowTime.Hour)); lcd.print(":"); lcd.print(p2Digits(NowTime.Minute)); switch (NowTime.ClockMode){ case AMhr: lcd.print(" AM "); break; case PMhr: lcd.print(" PM "); break; case M24hr: lcd.print(" M "); break; default: //do nothing break; } if (CurrentTemperature < 100.0) { lcd.print(" "); } lcd.print(String(CurrentTemperature,1)); // converts float to string // with 1 decimal place lcd.print((char)223); // prints the degree symbol if (Fahrenheit) { lcd.print("F"); } else { lcd.print("C"); } //Second Row dow mm/dd/yyyy lcd.setCursor(0,1); // Column, Row lcd.print(dow2Str(NowTime.Dow)); // Integer Day of the week // convert to String with // an optional leading zero lcd.print(" "); lcd.print(p2Digits(NowTime.Month)); lcd.print("/"); lcd.print(p2Digits(NowTime.Day)); lcd.print("/"); int i = 2000 + NowTime.Year; lcd.print(i); lcd.write(4); //Skinny letter A lcdAlarmIndicator(); //lcd.print A1, A2, BA, or - PreviousTime = Clock.read(); } } void displayAlarm(byte index=1, bool changeFlag=false) { /* ***************************************************** * * Display Alarm Clock * * Parameters: * index - the integer value of the alarm clock to * display - 1 or 2 * ***************************************************** */ /* Reminder of AlarmTime Structure: struct AlarmTime { uint8_t Second; // 0-59 = 6 bits 0=for alarm2 uint8_t Minute; // 0-59 = 6 bits uint8_t Hour; // 0-23 = 5 bits uint8_t AlarmMode; // 0=Daily, 1=Weekday, 2=Weekend, 3=Once uint8_t ClockMode; // 0-2; 0=AM, 1=PM, 2=24hour bool Enabled; // true/false } */ /* LCD alarm display pseudo code: Alarm 1 ON hh:mm AM Daily Alarm 1 OFF hh:mm PM Weekday Alarm 1 ON hh:mm AM Weekend Alarm 2 ON hh:mm 24 Once */ AlarmTime alarm; //create AlarmTime struct from Library if (index == alarm2) { alarm = Clock.readAlarm(alarm2); // get the latest alarm2 values } else { alarm = Clock.readAlarm(alarm1); // get the latest alarm1 values } // Check for Alarm change if (alarm.Hour != PreviousAlarm.Hour){ changeFlag = true; } if (alarm.Minute != PreviousAlarm.Minute){ changeFlag = true; } if (alarm.ClockMode != PreviousAlarm.ClockMode) { changeFlag = true; } if (alarm.AlarmMode != PreviousAlarm.AlarmMode) { changeFlag = true; } //Update Display - Only change display if change is detected if (changeFlag == true){ lcd.clear(); // First row lcd.setCursor(0,0); if (index == alarm2) { lcd.print("Alarm 2"); } else { lcd.print("Alarm 1"); } lcd.setCursor(13,0); if (alarm.Enabled == true) { lcd.print("ON"); } else { lcd.print("OFF"); } //Second row lcd.setCursor(0,1); lcd.print(p2Digits(alarm.Hour)); lcd.print(":"); lcd.print(p2Digits(alarm.Minute)); switch (alarm.ClockMode){ case AMhr: //AM lcd.print(" AM"); break; case PMhr: //PM lcd.print(" PM"); break; case M24hr: //24hr lcd.print(" M"); break; default: lcd.print(" M"); break; } switch (alarm.AlarmMode){ //0=Daily, 1=Weekday, 2=Weekend, 3=Once case 0: //Daily lcd.print(" Daily"); break; case 1: //Weekday lcd.print(" Weekday"); break; case 2: //Weekend lcd.print(" Weekend"); break; case 3: //Once lcd.print(" Once"); break; default: //do nothing break; } PreviousAlarm = alarm; } } void changeHour(byte i=clock0, bool increment = true){ /* Increments or decrements the hour by one * i = 0 Clock * = 1 Alarm1 * = 2 Alarm2 */ AlarmTime alarm; DateTime NowTime; //create DateTime struct from Library int Hour; byte ClockMode; switch (i){ case clock0: //Clock NowTime = Clock.read(); // get the latest clock values Hour = NowTime.Hour; ClockMode = NowTime.ClockMode; break; case alarm1: //alarm1 alarm = Clock.readAlarm(alarm1); Hour = alarm.Hour; ClockMode = alarm.ClockMode; break; case alarm2: //alarm2 alarm = Clock.readAlarm(alarm2); Hour = alarm.Hour; ClockMode = alarm.ClockMode; break; default: //Clock NowTime = Clock.read(); // get the latest clock values Hour = NowTime.Hour; ClockMode = NowTime.ClockMode; break; } switch (ClockMode){ case AMhr: case PMhr: if (increment == true){ Hour += 1; Hour %= 12; } else { Hour -= 1; Hour %= 12; } if (Hour <= 0) { Hour = 12; } //Serial.print("12Hour = ");Serial.println(Hour); break; case M24hr: if (increment == true){ Hour += 1; Hour %= 24; } else { Hour -= 1; Hour %= 24; } if (Hour < 0) { Hour = 23;} //Serial.print("24Hour = ");Serial.println(Hour); break; default: //do nothing break; } switch (i){ case clock0: //Clock NowTime.Hour = byte(Hour); Clock.write(NowTime); break; case alarm1: //alarm1 Serial.println("Setting Alarm1"); alarm.Hour = byte(Hour); Serial.print("alarm.Hour = ");Serial.println(alarm.Hour); Clock.setAlarm(alarm,1); break; case alarm2: //alarm2 alarm.Hour = Hour; Clock.setAlarm(alarm,2); break; default: //Clock NowTime.Hour = Hour; Clock.write(NowTime); break; } Serial.println("End changeHour"); //TODO: Error checking. Would return 0 for fail and 1 for OK } void changeMinute(byte i=0, bool increment = true){ /* Increments or decrements the minute by one * i = 0 Clock * = 1 Alarm1 * = 2 Alarm2 */ AlarmTime alarm; DateTime NowTime; //create DateTime struct from Library int Minute; switch (i){ case clock0: //Clock NowTime = Clock.read(); // get the latest clock values Minute = NowTime.Minute; break; case alarm1: //alarm1 alarm = Clock.readAlarm(alarm1); Minute = alarm.Minute; break; case alarm2: //alarm2 alarm = Clock.readAlarm(alarm2); Minute = alarm.Minute; break; default: //Clock NowTime = Clock.read(); // get the latest clock values Minute = NowTime.Minute; break; } if (increment == true) { Minute += 1; Minute %= 60; } else { Minute -= 1; Minute %= 60; } // Note a byte is from 0-255, no negative number // that's why we need an int here if (Minute < 0) { Minute = 59; } switch (i){ case clock0: //Clock NowTime.Minute = byte(Minute); Clock.write(NowTime); break; case alarm1: //alarm1 alarm.Minute = byte(Minute); Clock.setAlarm(alarm,1); break; case alarm2: //alarm2 alarm.Minute = byte(Minute); Clock.setAlarm(alarm,2); break; default: //Clock NowTime.Minute = byte(Minute); Clock.write(NowTime); break; } //TODO: Error checking. Would return 0 for fail and 1 for OK } void changeClockMode(byte i=0, bool increment = true){ /* Change Clock's ClockMode to AM=0, PM=1 or 24=2 * Limited change of Alarm's ClockMode to AM or PM * or no change if 24hr * i = 0 Clock0 * = 1 Alarm1 * = 2 Alarm2 */ AlarmTime alarm; DateTime NowTime = Clock.read(); //create DateTime struct from Library int ClockMode = NowTime.ClockMode; //int is able to be negative switch (i){ case clock0: //Clock if (increment == true) { ClockMode += 1; ClockMode %= 3; } else { ClockMode -= 1; ClockMode %= 3; } if (ClockMode < 0) { ClockMode = 2; } NowTime.ClockMode = byte(ClockMode); Clock.write(NowTime); fixAlarmClockMode(alarm1, NowTime.ClockMode); fixAlarmClockMode(alarm2, NowTime.ClockMode); break; case alarm1: case alarm2: //alarm1 or alarm2 if (ClockMode != M24hr){ alarm = Clock.readAlarm(i); if (alarm.ClockMode == AMhr){ alarm.ClockMode = PMhr; } else { alarm.ClockMode = AMhr; } Clock.setAlarm(alarm, i); } //else do nothing break; default: //do nothing break; } //TODO: Error checking. Would return 0 for fail and 1 for OK } void changeAlarmMode(byte i=1, bool increment = true){ /* Change AlarmMode to 0=Daily, 1=Weekday, 2=Weekend, 3=Once * i = 1 Alarm1 * = 2 Alarm2 */ if ((i==1)||(i=2)){ // Instantiates object as struct AlarmTIme AlarmTime alarm = Clock.readAlarm(i); int AlarmMode = alarm.AlarmMode;; if (increment == true) { AlarmMode += 1; AlarmMode %= 4; } else { AlarmMode -= 1; AlarmMode %= 4; } if (AlarmMode < 0) { AlarmMode = 3; } //Serial.print("AlarmMode = ");Serial.println(AlarmMode,BIN); alarm.AlarmMode = byte(AlarmMode); Clock.setAlarm(alarm,i); }//TODO: Error checking. Would return 0 for fail and 1 for OK } void changeTemp(void){ //change the temperature to F or C Fahrenheit = !Fahrenheit; CurrentTemperature = getTemperatureValue(); RunTime = millis(); displayClock(true); } void changeMonth(byte i=0, bool increment = true){ DateTime NowTime; NowTime = Clock.read(); int Month = NowTime.Month; if (increment == true) { Month += 1; } else { Month -= 1; } if (Month > 12) { Month = 1; } if (Month < 1) { Month = 12; } NowTime.Month = byte(Month); Clock.write(NowTime); } void changeDay(byte i=0, bool increment = true){ DateTime NowTime; NowTime = Clock.read(); int Day = NowTime.Day; byte Month = NowTime.Month; byte Year = NowTime.Year + 2000; byte DaysMax = 31; switch (Month){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: DaysMax = 31; break; case 2: DaysMax = 28; if ((Year % 4 == 0) && (Year % 100 != 0) || ( Year % 400 == 0)){ //those are the conditions to have a leap year DaysMax = 29; } break; case 4: case 6: case 9: case 11: DaysMax = 30; break; default: break; } //Serial.print("DaysMax = ");Serial.println(DaysMax); if (increment == true) { Day += 1; } else { Day -= 1; } if (Day < 1) { Day = DaysMax; } if (Day > DaysMax){Day = 1;} //Serial.print("changeDay saved = "); Serial.println(Day); NowTime.Day = byte(Day); Clock.write(NowTime); } void changeYear(byte i=0, bool increment = true){ DateTime NowTime; NowTime = Clock.read(); int Year = NowTime.Year; if (increment == true) { Year += 1; } else { Year -= 1; } if (Year < 18) { Year = 199; } if (Year > 199){ Year = 18; } NowTime.Year = byte(Year); Clock.write(NowTime); } void fixAlarmClockMode(byte alarmIndex, byte NewClockMode ){ /** ******************************************************** * Fixes alarm clockmode if clock.clockmode is switch * between 12hr and 24hr clockmodes ********************************************************* */ AlarmTime alarm = Clock.readAlarm(alarmIndex); //Clock Modes: //const byte AMhr=0; //const byte PMhr=1; //const byte M24hr=2; //TODO: check alarmIndex, check NewClockMode if ((NewClockMode == AMhr)||(NewClockMode == PMhr)){ if (alarm.Hour > 12){ alarm.ClockMode = PMhr; } else { alarm.ClockMode = AMhr; } alarm.Hour %= 12; if (alarm.Hour == 0){ alarm.Hour = 12;} } else if (NewClockMode == M24hr) { //Convert to 24hr alarm.Hour %= 12; alarm.Hour += (12 * alarm.ClockMode); alarm.ClockMode = M24hr; } Clock.setAlarm(alarm, alarmIndex); } void toggleShowAlarm(byte i=1){ if ((i == 1)||(i == 2)){ if(i == 2){ ClockState = ShowAlarm2; } else { ClockState = ShowAlarm1; } AlarmTime alarm; alarm = Clock.readAlarm(i); alarm.Enabled = !alarm.Enabled; Clock.setAlarm(alarm, i); AlarmRunTime = millis(); displayAlarm(i, true); } //otherwise do nothing } void toggleLED(bool ledON = true){ bool ledState; ledState = digitalRead(LED_Pin); //get the state of LED if (ledON == true) { digitalWrite(LED_Pin, !ledState); //do the opposite } else { digitalWrite(LED_Pin, LOW); } } void toggleBuzzer(void){ /* Plays alarm beeps and ends */ /* Code found from arduino web site */ for (int thisNote = 0; thisNote < 5; thisNote++) { // to calculate the note duration, take one second divided by the note type. // e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. int noteDuration = 1000 / noteDurations[thisNote]; tone(BUZZER_Pin, melody[thisNote], noteDuration); // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 1.30; delay(pauseBetweenNotes); // stop the tone playing: noTone(BUZZER_Pin); } } void Snooze(void){ /* Begin the clock.snoozealarm method to delay the alarm * for SnoozePeriod. It also clears alarm flags. */ // Global variable ActiveAlarms will have which alarm is active Serial.println("Snooze Activated"); switch (ActiveAlarms){ case 0: //No flagged alarms break; case alarm1: //alarm 1 Clock.snoozeAlarm(1, SnoozePeriod); break; case alarm2: //alarm 2 Clock.snoozeAlarm(2, SnoozePeriod); break; case 3: //both alarms Clock.snoozeAlarm(1, SnoozePeriod); Clock.snoozeAlarm(2, SnoozePeriod); break; default: //do nothing break; } toggleLED(false); // Confirm LED turned off lcd.display(); // Just in case it was off } void clearAlarms(void){ //Clear alarm flags Clock.clearAlarms(); //toggleBuzzer(); toggleLED(false); lcd.display(); // Just in case it was off } void editClock(byte i=0){ //First Row hh:mm AM ###.#°F //Second Row dow mm/dd/yyyyA^ // hh mm AM F mm dd yyyy byte cursorPositions[][2] = {{1,0},{4,0},{7,0},{15,0},{5,1},{8,1},{13,1}}; //lcd.setCursor(Column, Row); //Serial.print("editclock position = "); Serial.println(i); lcd.setCursor(cursorPositions[i][0],cursorPositions[i][1]); lcd.cursor(); lcd.blink(); } void editAlarm(byte i=0){ /* Alarm 1 ON hh:mm AM Weekday hh mm AM Weekday */ //Note valid i values are 0-3 //lcd.setCursor(Column, Row); byte cursorPositions[][2] = {{1,1},{4,1},{7,1},{9,1}}; //Serial.print("editAlarm position = ");Serial.println(i); lcd.setCursor(cursorPositions[i][0],cursorPositions[i][1]); lcd.cursor(); lcd.blink(); } void ButtonClick(Button& b){ //Clocks //const byte clock0=0; //const byte alarm1=1; //const byte alarm2=2; //Debug code to Serial monitor Serial.print("Button Click - "); switch(b.pinValue()){ case Snooze_Pin: Serial.println("Snooze_Pin"); break; case Lt_Pin: Serial.println("Lt_Pin"); break; case Rt_Pin: Serial.println("Rt_Pin"); break; default: //do nothing break; } if (bHoldButtonFlag == true) { // After a hold button is released, a button click is also registered // ignore clicks for SkipClickTime ms // if ((millis() - buttonHoldPrevTime) > SkipClickTime) { bHoldButtonFlag = false;} Serial.println("Button Click ignored"); bHoldButtonFlag = false; } else { //PowerLoss,ShowClock, Alarm, EditClock, EditAlarm1, EditAlarm2 switch (ClockState){ case PowerLoss: //any clickbutton and return to ShowClock ClockState = ShowClock; Clock.clearOSFStatus(); break; case ShowClock: //ShowClock Mode //show alarm screens switch (b.pinValue()){ case Snooze_Pin: //Do Nothing break; case Lt_Pin: toggleShowAlarm(alarm1); break; case Rt_Pin: toggleShowAlarm(alarm2); break; default: //do nothing break; } break; //ShowAlarm1 or ShowAlarm2 does nothing case Alarm: //Alarm Mode switch (b.pinValue()){ case Snooze_Pin: //Snooze alarm for 9 minutes Snooze(); ClockState = ShowClock; break; case Lt_Pin: case Rt_Pin: //turn off alarms clearAlarms(); ClockState = ShowClock; break; default: //do nothing break; } break; case EditClock: //Edit Clock Mode switch (b.pinValue()){ case Snooze_Pin: //Increments cursor position //cpIndex += 1 % 7; cpIndex += 1; cpIndex %= 7; break; case Lt_Pin: // Decrements value // First Row hh:mm AM ###.#°F // 0 1 2 3 // Second Row dow mm/dd/yyyy // 4 5 6 switch (cpIndex){ case 0: //edit Hours changeHour(clock0, false); break; case 1: //edit Minute changeMinute(clock0, false); break; case 2: //edit ClockMode changeClockMode(clock0, false); break; case 3: //Farenheit changeTemp(); break; case 4: //edit month changeMonth(clock0, false); break; case 5: //edit day changeDay(0, false); break; case 6: //edit year changeYear(clock0, false); break; default: //do nothing break; } break; case Rt_Pin: // Increments value switch (cpIndex){ case 0: //edit Hours changeHour(clock0, true); break; case 1: //edit Minute changeMinute(clock0, true); break; case 2: //edit ClockMode changeClockMode(clock0, true); break; case 3: //Farenheit changeTemp(); break; case 4: //edit month changeMonth(clock0, true); break; case 5: //edit day changeDay(clock0, true); break; case 6: //edit year changeYear(clock0, true); break; default: //do nothing break; } break; default: //do nothing break; } //End EditClock break; case EditAlarm1: //Edit Alarm1 Mode switch (b.pinValue()){ case Snooze_Pin: //Increments cursor position cpIndex += 1; cpIndex %= 4; //cpIndex += 1 % 4; didn't work break; case Lt_Pin: // Decrements value hh:mm AM Weekday //cpIndex is global switch (cpIndex){ case 0: //edit Hours changeHour(alarm1, false); break; case 1: //edit Minute changeMinute(alarm1, false); break; case 2: //edit ClockMode changeClockMode(alarm1, false); break; case 3: //AlarmMode changeAlarmMode(alarm1, false); break; default: //do nothing break; } break; case Rt_Pin: // Increments value //cpIndex is global switch (cpIndex){ case 0: //edit Hours changeHour(alarm1, true); break; case 1: //edit Minute changeMinute(alarm1, true); break; case 2: //edit ClockMode changeClockMode(alarm1, true); break; case 3: //AlarmMode changeAlarmMode(alarm1, true); break; default: //do nothing break; } break; default: //do nothing break; } break; case EditAlarm2: //Edit Alarm2 Mode switch (b.pinValue()){ case Snooze_Pin: //Increments cursor position cpIndex += 1; cpIndex %= 4; break; case Lt_Pin: // Decrements value hh:mm AM Weekday //cpIndex is global switch (cpIndex){ case 0: //edit Hours changeHour(alarm2, false); break; case 1: //edit Minute changeMinute(alarm2, false); break; case 2: //edit ClockMode changeClockMode(alarm2, false); break; case 3: //AlarmMode changeAlarmMode(alarm2, false); break; default: //do nothing break; } break; case Rt_Pin: // Increments value //cpIndex is global switch (cpIndex){ case 0: //edit Hours changeHour(alarm2, true); break; case 1: //edit Minute changeMinute(alarm2, true); break; case 2: //edit ClockMode changeClockMode(alarm2, true); break; case 3: //AlarmMode changeAlarmMode(alarm2, true); break; default: //do nothing break; } break; default: //do nothing break; } break; default: //todo break; } } } void ButtonHold(Button& b){ //Clock States: // PowerLoss, ShowClock, ShowAlarm1, ShowAlarm2, Alarm, EditClock, EditAlarm1, EditAlarm2 // static unsigned long buttonHoldPrevTime = 0; //Debug code to Serial monitor Serial.print("Button Hold - "); switch(b.pinValue()){ case Snooze_Pin: Serial.println("Snooze_Pin"); break; case Lt_Pin: Serial.println("Lt_Pin"); break; case Rt_Pin: Serial.println("Rt_Pin"); break; default: //do nothing break; } // To ignore back to back button hold? if ((millis()-buttonHoldPrevTime) > 2000){ switch (ClockState){ case PowerLoss: //Any button held //Edit main clock display ClockState = EditClock; cpIndex = 0; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; Clock.clearOSFStatus(); break; case ShowClock: switch (b.pinValue()){ case Snooze_Pin: //Edit main clock display ClockState = EditClock; cpIndex = 0; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; break; case Lt_Pin: //Edit Alarm1 ClockState = EditAlarm1; cpIndex = 0; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayAlarm(1,true); break; case Rt_Pin: //Edit Alarm2 ClockState = EditAlarm2; cpIndex = 0; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayAlarm(2,true); break; default: break; } break; case ShowAlarm1: switch (b.pinValue()){ case Snooze_Pin: break; case Lt_Pin: ClockState = EditAlarm1; cpIndex = 0; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayAlarm(1,true); //Switch to edit mode break; case Rt_Pin: //Do Nothing break; default: break; } break; case ShowAlarm2: switch (b.pinValue()){ case Snooze_Pin: break; case Lt_Pin: break; case Rt_Pin: //Edit Alarm2 ClockState = EditAlarm2; cpIndex = 0; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayAlarm(2,true); break; default: break; } break; case Alarm: //Alarm Mode switch (b.pinValue()){ case Snooze_Pin: Snooze(); //Snooze alarm for 9 minutes ClockState = ShowClock; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayClock(true); break; case Lt_Pin: case Rt_Pin: //turn off alarms clearAlarms(); ClockState = ShowClock; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayClock(true); break; default: //do nothing break; } break; case EditClock: //Edit Clock switch (b.pinValue()){ case Snooze_Pin: lcd.noBlink(); lcd.noCursor(); ClockState = ShowClock; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; break; case Lt_Pin: case Rt_Pin: default: break; } break; case EditAlarm1: //Edit Alarm1 switch (b.pinValue()){ case Snooze_Pin: lcd.noBlink(); lcd.noCursor(); ClockState = ShowClock; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayClock(true); break; case Lt_Pin: case Rt_Pin: default: break; } break; case EditAlarm2: //Edit Alarm1 switch (b.pinValue()){ case Snooze_Pin: lcd.noBlink(); lcd.noCursor(); ClockState = ShowClock; buttonHoldPrevTime = millis(); bHoldButtonFlag = true; displayClock(true); break; case Lt_Pin: case Rt_Pin: default: break; } break; default: //todo break; } } } /* //char *dow2Str(byte bDow) { // // Day of week to string or char array. DOW 1=Sunday, 0 is undefined // static const char *str[] = {"---", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // if (bDow > 7) bDow = 0; // return(str[bDow]); //} */ String dow2Str(byte bDow) { // Day of week to string or char array. DOW 1=Sunday, 0 is undefined static const char *str[] = {"---", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; if (bDow > 7) bDow = 0; return(str[bDow]); } String p2Digits(int numValue) { // utility function for digital clock display // converts int to two digit char array String str; if(numValue < 10) { str = "0" + String(numValue); } else { str = String(numValue); } return str; } float getTemperatureValue(){ // Value from Clock.getTemperatureFloat() in in Celsius float floatTemperature; floatTemperature = Clock.getTemperatureFloat(); if (Fahrenheit == true) { floatTemperature = floatTemperature*9.0/5.0+32.0; } return floatTemperature; } byte CheckAlarmStatus(){ /* Returns: 0 - No alarms 1 - Alarm 1 enabled 2 - Alarm 2 enabled 3 - Both alarms enabled */ bool AlarmStatus = digitalRead(SQW_Pin); byte flaggedAlarms = Clock.flaggedAlarms(); //INTSQW is Active-Low Interrupt or Square-Wave Output if (AlarmStatus == LOW){ //Alarm detected ClockState = Alarm; } return flaggedAlarms; } void lcdAlarmIndicator(){ byte alarmEnabledStatus; alarmEnabledStatus = Clock.alarmStatus(); /* Returns: 0 - No alarms 1 - Alarm 1 enabled 2 - Alarm 2 enabled 3 - Both alarms enabled */ switch (alarmEnabledStatus){ case 0: //No alarms lcd.print("-"); break; case 1: //alarm 1 enabled lcd.write(1); //cA1 break; case 2: //alarm 2 enabled lcd.write(2); //cA2 break; case 3: //both alarms enabled lcd.write(3); //cBA break; default: break; } } /* *********************************************************** * Void Setup * * ********************************************************* */ void setup() { // Get the start time RunTime = millis(); //Serial Monitor Serial.begin(9600); Serial.println("Setup Begin"); /* Pin Modes */ pinMode(LED_Pin, OUTPUT); digitalWrite(LED_Pin, LOW); pinMode(BUZZER_Pin, OUTPUT); digitalWrite(BUZZER_Pin, LOW); //attachInterrupt(digitalPinToInterrupt(2), Alarm, FALLING); /* LCD Stuff */ lcd.begin(16, 2); //Create custom lcd characters lcd.createChar(1, cA1); lcd.createChar(2, cA2); lcd.createChar(3, cBA); lcd.createChar(4, cSA); /* Clock Stuff */ Clock.begin(); //Clock.setInterruptCtrl(true); if (Clock.getOSFStatus() == true){ //Restart from power loss detected ClockState = PowerLoss; Serial.println("PowerLoss State"); } CurrentTemperature = getTemperatureValue(); /* Button callback functions */ LtKey.clickHandler(ButtonClick); LtKey.holdHandler(ButtonHold,Button_Hold_Time); RtKey.clickHandler(ButtonClick); RtKey.holdHandler(ButtonHold,Button_Hold_Time); SnoozeKey.clickHandler(ButtonClick); SnoozeKey.holdHandler(ButtonHold,Button_Hold_Time); //Display the clock displayClock(true); //Debug code //byte byteValue; Serial.print("Register 0x0E = ");Serial.println(Clock.getCtrlRegister(), BIN); Serial.print("Register 0x0F = ");Serial.println(Clock.getStatusRegister(), BIN); //Clock.readByte(0x0f,byteValue); //Serial.print("Register 0x0F = ");Serial.println(byteValue, BIN); Serial.println("Setup End"); } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop() { static long previousMillis = 0; //if (ClockState != PrevState) { Serial.print("ClockState = ");Serial.println(ClockState); PrevState = ClockState;} switch (ClockState){ case PowerLoss: if (ClockState != PrevState) { Serial.println("ClockState = PowerLoss"); PrevState = ClockState;} //Serial.println("PowerLoss"); displayClock(); //Flash Clock if ((millis()-previousMillis) >= flashInterval) { previousMillis = millis(); if (bDisplayStatus == true){ lcd.noDisplay(); } else { lcd.display(); } bDisplayStatus = !bDisplayStatus; } break; case ShowClock: if (ClockState != PrevState) { Serial.println("ClockState = ShowClock"); PrevState = ClockState;} //Serial.println("ShowClock"); //lcd.display(); // Just in case it was off displayClock(); break; case ShowAlarm1: if (ClockState != PrevState) { Serial.println("ClockState = ShowAlarm1"); PrevState = ClockState;} //AlarmRunTime is defined by toggleShowAlarm if ((millis()-AlarmRunTime) <= Alarm_View_Pause) { displayAlarm(alarm1); } else { ClockState = ShowClock; displayClock(true); } break; case ShowAlarm2: if (ClockState != PrevState) { Serial.println("ClockState = ShowAlarm2"); PrevState = ClockState;} //AlarmRunTime is defined by toggleShowAlarm if ((millis()-AlarmRunTime) <= Alarm_View_Pause) { displayAlarm(alarm2); } else { ClockState = ShowClock; displayClock(true); } break; case Alarm: //Alarm mode if (ClockState != PrevState) { Serial.println("ClockState = Alarm"); PrevState = ClockState;} displayClock(); //Flash Clock if ((millis()-previousMillis) >= flashInterval) { previousMillis = millis(); if (bDisplayStatus == true){ lcd.noDisplay(); } else { lcd.display(); } bDisplayStatus = !bDisplayStatus; toggleLED(); toggleBuzzer(); } break; case EditClock: //Edit ClockMode if (ClockState != PrevState) { Serial.println("ClockState = EditClock"); PrevState = ClockState;} editClock(cpIndex); displayClock(); break; case EditAlarm1: //Edit Alarm1 if (ClockState != PrevState) { Serial.println("ClockState = EditAlarm1"); PrevState = ClockState;} editAlarm(cpIndex); displayAlarm(alarm1); break; case EditAlarm2: //Edit Alarm2 if (ClockState != PrevState) { Serial.println("ClockState = EditAlarm2"); PrevState = ClockState;} editAlarm(cpIndex); displayAlarm(alarm2); break; default: Serial.println("ClockState = default!!"); displayClock(); break; } LtKey.process(); RtKey.process(); SnoozeKey.process(); ActiveAlarms = CheckAlarmStatus(); //Returns which alarms are activated } ================================================ FILE: Lesson 19 - Real Time Clock Module/RTC_Alarm/RTC_Alarm.ino.standard.hex ================================================ :100000000C94FE000C9426010C9426010C942601FD :100010000C9426010C9426010C9426010C941709CB :100020000C9426010C9426010C9426010C942601B4 :100030000C9426010C9426010C9426010C942601A4 :100040000C942E1A0C9426010C94050C0C94DF0BC6 :100050000C9426010C9426010C9426010C94260184 :100060000C946F0D0C9426019E06B906E806C7068F :10007000030712072D072D07F507F707F9071D08D6 :10008000FB07FD07FF070E0814081A081D082108C2 :1000900026082B085D1CA21CB21CD61C011D1F1FAC :1000A000551F6C1F00407A10F35A00A0724E1809B9 :1000B0000010A5D4E80000E87648170000E40B54CF :1000C000020000CA9A3B000000E1F505000080969E :1000D0009800000040420F000000A08601000000D0 :1000E000102700000000E80300000000640000008A :1000F00000000A00000000000100000000002C7653 :10010000D888DC674F0823DFC1DFAE59E1B1B7966D :10011000E5E3E453C63AE651997696E8E6C28426CA :10012000EB898C9B62ED407C6FFCEFBC9C9F40F2A6 :10013000BAA56FA5F490055A2AF75C936B6CF96722 :100140006DC11BFCE0E40D47FEF520E6B500D0EDE7 :10015000902E0300943577050080841E080000204F :100160004E0A000000C80C333333330F986E1283ED :100170001141EF8D2114893BE65516CFFEE6DB18C1 :10018000D1844B381BF77C1D901DA4BBE424203286 :1001900084725E228100C9F124ECA1E53D270200B2 :1001A000000000240027002A00000000002500288D :1001B000002B000000000023002600290004040496 :1001C0000404040404020202020202030303030300 :1001D00003010204081020408001020408102001DD :1001E00002040810200000000800020100000304BF :1001F000070000000000000000005B2011241FBE6B :10020000CFEFD8E0DEBFCDBF26E0ACECB3E001C05D :100210001D92A930B207E1F713E0A0E0B1E0ECEAEB :10022000F0E502C005900D92AC3CB107D9F710E0A3 :10023000CEEFD0E004C02197FE010E944B26CD3FB7 :10024000D107C9F70E94781A0C9454280C94000026 :100250000F931F93CF93DF9300D000D000D0CDB782 :10026000DEB7082F162F0E949211842F462F298364 :100270003A838B835C836D837E83123080F48D3070 :1002800018F091E09D8301C01D822CE0622F0E9436 :10029000D625992311F09B830DC02B830BC0123000 :1002A00049F42CE0622F0E94D625429F900D112424 :1002B0009B831D83602FCE0101960E946C142696AD :1002C0000FB6F894DEBF0FBECDBFDF91CF911F9167 :1002D0000F9108950F931F93CF93DF9300D000D019 :1002E00000D0CDB7DEB7182F062F813009F012E00D :1002F000812F0E94921129833A834B836D837E83E1 :10030000852F90E0002321F001968370992709C082 :10031000019764E070E00E94F62597FF02C083E039 :1003200090E08C83612FCE0101960E946C1426967A :100330000FB6F894DEBF0FBECDBFDF91CF911F91F6 :100340000F9108951F93CF93DF9300D000D000D07A :10035000CDB7DEB7BE016F5F7F4F8FE00E94CB1637 :10036000198110FF22C08091DA05882361F081E0B5 :100370000E942F1129833A834B835C836D837E8394 :100380001092DA0509C081E00E94921129833A8314 :100390004B835C836D837E838C81833009F41E8262 :1003A00061E0CE0101960E946C1411FF22C0809181 :1003B000DB05882361F082E00E942F1129833A83B4 :1003C0004B835C836D837E831092DB0509C082E0E2 :1003D0000E94921129833A834B835C836D837E83D1 :1003E0008C81833009F41E8262E0CE0101960E9466 :1003F0006C14612F6C7F8FE00E947E138DE00E9451 :10040000541960E08DE00E947D190E947A152696AD :100410000FB6F894DEBF0FBECDBFDF91CF911F9115 :1004200008958FEA91E00E9485148091EB03823059 :1004300041F0833019F0813039F404C081E00E942A :100440001A1882E00E941A188DE00E94541960E088 :100450008DE00E947D190C947A150F931F93CF9312 :10046000DF93CDB7DEB72E970FB6F894DEBF0FBE81 :10047000CDBF182F062F0E94F01129833A834B839A :100480005C836D837E838F839887892F90E011230F :1004900019F01330A8F51FC0002331F0019663E076 :1004A00070E00E94F62509C0019763E070E00E94A9 :1004B000F62597FF02C082E090E08887CE01019682 :1004C0000E949814688581E00E942801688582E076 :1004D0000E94280115C0029799F0812F0E94921165 :1004E00029873A874B875C877E87611103C081E04B :1004F0008D8701C01D86612FCE0109960E946C1464 :100500002E960FB6F894DEBF0FBECDBFDF91CF9110 :100510001F910F9108950F931F93CF93DF93CDB742 :10052000DEB72E970FB6F894DEBF0FBECDBF182FE3 :10053000062F813029F070F0823061F482E001C032 :1005400081E00E94921129873A874B875C876D87EB :100550007E870AC00E94F01129833A834B835C8313 :100560006D837E838F839887832F90E0002331F003 :1005700001966CE370E00E94F62509C001976CE3D8 :1005800070E00E94F62597FF02C08BE390E01130E7 :1005900031F060F0123051F48A8762E002C08A873D :1005A00061E0CE0109960E946C1405C08A83CE01D9 :1005B00001960E9498142E960FB6F894DEBF0FBED7 :1005C000CDBFDF91CF911F910F910895EF92FF92D0 :1005D0000F931F93CF93DF93CDB7DEB72E970FB650 :1005E000F894DEBF0FBECDBFF82EE62E81E0F816E0 :1005F000C1F0F81620F082E0F81619F132C00E941E :10060000F01129833A834B835C836D837E838F83D0 :100610009887042F10E09230A8F1923009F443C07B :1006200082C081E00E94921129873A874B875C87BC :100630006D877E87042F10E0623020F1623099F1DF :100640004FC082E00E94921129873A874B875C87CE :100650006D877E87042F10E06230A0F0623019F1C0 :100660005BC00E94F01129833A834B835C836D83C6 :100670007E838F839887042F10E0923018F0923099 :1006800091F025C0C801EE2011F0019601C001973C :100690006CE070E00E94F6258C0118161906BCF07B :1006A0000CE010E014C0C801EE2039F0019668E1BA :1006B00070E00E94F6258C010AC0019768E170E0A5 :1006C0000E94F6258C0197FF02C007E110E081E04F :1006D000F81631F0F81638F182E0F81224C01CC088 :1006E00080EC91E00E9485140B876FEC71E085EB44 :1006F00094E00E94DD0B4B8550E060E070E02AE062 :1007000085EB94E00E94940B6DED71E085EB94E035 :100710000E947F0B61E002C00B8762E0CE01099668 :100720000E946C1405C00B83CE0101960E949814A0 :1007300080EE91E00E9485142E960FB6F894DEBFED :100740000FBECDBFDF91CF911F910F91FF90EF9022 :1007500008950F931F93CF93DF93CDB7DEB72897FC :100760000FB6F894DEBF0FBECDBF98E0EDE2F1E02A :10077000DE01119601900D929A95E1F7FE013196F6 :10078000E80FF11DE80FF11D618180810E9484183E :1007900003EE15E0F8018089982F9260908B8A60B3 :1007A0000E946C15F8018089982F9160908B896068 :1007B00028960FB6F894DEBF0FBECDBFDF91CF9164 :1007C0001F910F910C946C15CF92DF92EF92FF92D4 :1007D0000F931F93CF93DF93CDB7DEB72C970FB650 :1007E000F894DEBF0FBECDBFC82ED62E82E0C81251 :1007F00081E00E9492112F837C87062F152FF42E03 :10080000E32E8091D6038F1511F0DD24D3948091CF :10081000D503E81611F0DD24D3948091D803801716 :1008200011F0DD24D3948091D703181303C0DD2089 :1008300009F47AC00E94721560E080E00E9484187A :1008400082E0C81203C06FEE71E002C067EF71E092 :1008500083EE95E00E94DD0B60E08DE00E9484183D :100860008C85882319F06FEF71E002C062E072E0BE :1008700083EE95E00E94DD0B61E080E00E94841829 :100880006F2D70E0CE0101960E94450FCE010196BA :100890000E94CE18CE0101960E94FD0866E072E02B :1008A00083EE95E00E94DD0B6E2D70E0CE01019687 :1008B0000E94450FCE0101960E94CE18CE010196EE :1008C0000E94FD08013021F030F468E072E005C0BC :1008D0006CE072E002C060E172E083EE95E00E949D :1008E000DD0B113059F038F0123059F0133079F433 :1008F0006DE272E008C064E172E005C06BE172E095 :1009000002C064E272E083EE95E00E94DD0BE886AF :10091000F9861A870B8786E0FE013796A4EDB3E0CF :1009200001900D928A95E1F72C960FB6F894DEBFF0 :100930000FBECDBFDF91CF911F910F91FF90EF9030 :10094000DF90CF9008954F925F926F927F92BF9207 :10095000CF92DF92EF92FF920F931F93CF93DF938B :10096000CDB7DEB7AF970FB6F894DEBF0FBECDBFE1 :10097000182F0E94F011C32EB42EE62ED72EF82E7B :10098000092F2AA33BA34CA35DA36EA37FA388A733 :1009900099A70E94221A4090E7035090E8036090C4 :1009A000E9037090EA03DC01CB0184199509A609DB :1009B000B709883E9D4FA105B10530F490912601FD :1009C00080915E05981771F14090E3035090E40325 :1009D0006090E5037090E6030E94EF0E6093E303DE :1009E0007093E4038093E5039093E6030E94221A38 :1009F0006093E7037093E8038093E9039093EA031D :100A00008091260180935E052091E3033091E403F9 :100A10004091E5035091E603C301B2010E945723C0 :100A2000811111E08091CE038B1111E08091CD03F3 :100A3000C81211E08091D303801311E08091D0039C :100A4000E81211E08091D103D81211E08091D20315 :100A5000F81203C0112309F41FC10E94721560E04F :100A600080E00E9484186B2D70E0CE0101960E94F8 :100A7000450FCE0101960E94CE18CE0101960E942C :100A8000FD0866E072E083EE95E00E94DD0B6C2DC0 :100A900070E0CE0101960E94450FCE0101960E94A2 :100AA000CE18CE0101960E94FD08013049F028F0D1 :100AB000023061F46DE372E005C063E372E002C0EE :100AC00068E372E083EE95E00E94DD0B20E030E009 :100AD00048EC52E46091E3037091E4038091E503F4 :100AE0009091E6030E94572387FF06C063E572E0FA :100AF00083EE95E00E94DD0B6091E3037091E403C7 :100B00008091E5039091E6031BA61AA61DA61CA6DC :100B10001FA61EA68E010F5F1F4F21E043E00E941B :100B2000D020009771F0FC0101900020E9F7319787 :100B3000AF01481B590BBC01CE018A960E94DC080C :100B400004C0CE018A960E94CA08CE018A960E94ED :100B5000CE18CE018A960E94FD0841E06FED83EE2B :100B600095E00E94160D80912601882319F064E01B :100B700072E002C062E472E083EE95E00E94DD0B59 :100B800061E080E00E948418EDA1E83008F0E0E028 :100B9000F0E0EE0FFF1FEB5CFE4F60817181CE0134 :100BA00001960E940209CE0101960E94CE18CE0144 :100BB00001960E94FD0863E572E083EE95E00E94D5 :100BC000DD0B6D2D70E0CE0101960E94450FCE0128 :100BD00001960E94CE18CE0101960E94FD0864E4A1 :100BE00072E083EE95E00E94DD0B6E2D70E0CE0189 :100BF00001960E94450FCE0101960E94CE18CE01AB :100C000001960E94FD0864E472E083EE95E00E9484 :100C1000DD0B4F2D50E04053584F052E000C660B56 :100C2000770B2AE083EE95E00E94940B64E083EE5C :100C300095E00E94690D1982BE016F5F7F4F8EE0C3 :100C40000E94CB1689818370823069F0833069F00D :100C5000813039F065E972E083EE95E00E94DD0BAA :100C600009C061E003C062E001C063E083EE95E08B :100C70000E94690D0E94F0112093CC033093CD03A4 :100C80004093CE035093CF036093D0037093D1036E :100C90008093D2039093D303AF960FB6F894DEBF40 :100CA0000FBECDBFDF91CF911F910F91FF90EF90BD :100CB000DF90CF90BF907F906F905F904F9008959E :100CC0000F931F93CF93DF93EC0166E472E085EB03 :100CD00094E00E94DD0B8C818A3051F08B3029F03A :100CE000893051F480E692E005C085E592E002C0CB :100CF00087E692E00E9485140E94221A0091DB038D :100D00001091DC032091DD033091DE03DC01CB0187 :100D1000801B910BA20BB30B813D9740A105B10540 :100D200008F4BBC0E0912401F0912501E830F10501 :100D300008F0B3C0EC5CFF4F0C944B2685E090E0CC :100D400090932501809324011092EC030E94221AB3 :100D50006093DB037093DC038093DD039093DE03E9 :100D600081E08093DA03DF91CF911F910F910C9472 :100D7000D7188C818A3079F08B3059F585E090E076 :100D800090932501809324011092EC0358C08C812C :100D90008A3009F082C087E090E09093250180932B :100DA00024011092EC030E94221A6093DB037093DB :100DB000DC038093DD039093DE0381E08093DA030C :100DC00061E082E0DF91CF911F910F910C94E403D9 :100DD0008C81893009F061C086E090E09093250114 :100DE000809324011092EC030E94221A6093DB038B :100DF0007093DC038093DD039093DE0381E08093A6 :100E0000DA0361E0DFCF8C81893008F446C08B3093 :100E100030F08B3009F041C00E94110225C00E94C1 :100E2000A20122C08C818B30C1F50E94EC180E9477 :100E3000F41881E090E090932501809324010E94B2 :100E4000221A6093DB037093DC038093DD0390939D :100E5000DE0381E08093DA0320C08C818B30E9F4DB :100E60000E94EC180E94F41881E090E09093250114 :100E7000809324010E94221A6093DB037093DC03A9 :100E80008093DD039093DE0381E08093DA03DF91AA :100E9000CF911F910F910C94A304DF91CF911F91DB :100EA0000F9108959091260181E089278093260172 :100EB0000E94EF0E6093E3037093E4038093E503D5 :100EC0009093E6030E94221A6093E7037093E8036D :100ED0008093E9039093EA0381E00C94A304CF93F9 :100EE000DF93EC016EE672E085EB94E00E94DD0B8F :100EF0008C818A3051F08B3029F0893051F480E6B2 :100F000092E005C085E592E002C087E692E00E948B :100F100085148091DA03882339F08EE792E00E94ED :100F200085141092DA0309C1809124019091250162 :100F30008430910531F128F4009761F00197A1F018 :100F4000FCC08630910509F48BC080F1079709F445 :100F5000B8C0F3C081E090E0909325018093240114 :100F6000DF91CF910C94D7188C81893029F08A3089 :100F700009F0E3C082E001C081E0DF91CF910C94E1 :100F8000B30E8C81893008F4D8C08B3030F08B30B0 :100F900009F0D3C00E94110202C00E94A20181E0A8 :100FA00090E09093250180932401C7C08C818A3002 :100FB00041F18B3021F0893009F0BFC009C0809128 :100FC000EC038F5F67E00E94D6259093EC03B5C0D9 :100FD000E091EC038E2F90E08730910508F0ADC0D2 :100FE000FC01E45CFF4F0C944B2660E018C060E00D :100FF0001CC060E020C080E025C080E028C080E008 :101000002BC0E091EC038E2F90E08730910508F023 :1010100094C0FC01ED5BFF4F0C944B2661E080E037 :10102000DF91CF910C94E60261E080E0DF91CF91F7 :101030000C948B0261E080E077C0DF91CF910C943B :10104000520781E0DF91CF910C94531781E0DF913B :10105000CF910C948C1781E0DF91CF910C94E51720 :101060008C818A30B9F08B30A1F1893009F065C0EC :101070008091EC03813051F038F0823049F08330B8 :1010800009F05BC060E01BC060E011C060E012C00E :1010900060E013C08091EC03813059F038F0823069 :1010A00059F0833009F049C061E009C061E081E096 :1010B000B7CF61E081E0BACF61E081E035C081E087 :1010C00038C08C818A30E9F08B3019F08930A9F56D :1010D00007C08091EC038F5F83708093EC032DC079 :1010E0008091EC03813049F030F0823041F0833060 :1010F00021F560E01DC060E010C060E011C060E05C :1011000012C08091EC03813051F030F0823051F008 :10111000833099F461E00CC061E082E081CF61E04E :1011200082E084CF61E082E0DF91CF910C942D02C8 :1011300082E0DF91CF910C946A01DF91CF91089505 :1011400008950E943F280F931F93CF93DF93EC01E4 :1011500088819981009729F02A813B8126173707DA :1011600088F48B016F5F7F4F0E947927009761F0B1 :10117000998388831B830A832C813D81232B11F45F :10118000FC01108281E001C080E0DF91CF911F91CE :101190000F910895CF93DF93EC0188819981009797 :1011A00011F00E94F026198218821D821C821B8277 :1011B0001A82DF91CF910895EF92FF920F931F93C0 :1011C000CF93DF93EC017B018A01BA010E94A3084F :1011D000811104C0CE010E94CA0807C01D830C8380 :1011E000B701888199810E944D28CE01DF91CF916E :1011F0001F910F91FF90EF900895FC0180819181E4 :101200000C94F026FC011182108213821282158246 :1012100014826115710551F0FB0101900020E9F77E :101220003197AF01461B570B0C94DC0808951F92B1 :101230000F920FB60F9211242F933F934F935F930A :101240006F937F938F939F93AF93BF93EF93FF938E :101250008091F6039091F703A091F803B091F90300 :10126000892B8A2B8B2B51F19091F103E091F203A2 :10127000F091F3038081892780838091F603909118 :10128000F703A091F803B091F903181619061A068E :101290001B06C4F48091F6039091F703A091F80324 :1012A000B091F9030197A109B1098093F6039093D6 :1012B000F703A093F803B093F90304C080912001D1 :1012C0000E94540BFF91EF91BF91AF919F918F912D :1012D0007F916F915F914F913F912F910F900FBE32 :1012E0000F901F901895CF92DF92EF92FF920F937D :1012F0001F93CF93DF936C017A018B01C0E0D0E0A4 :10130000CE15DF0581F0D8016D918D01D601ED91EB :10131000FC910190F081E02DC6010995892B11F017 :101320002196EECF7E01C701DF91CF911F910F91E2 :10133000FF90EF90DF90CF900895FC01538D448D86 :10134000252F30E0842F90E0821B930B541710F070 :10135000CF96089501970895FC01918D828D98177D :1013600061F0828DDF01A80FB11D5D968C91928D89 :101370009F5F9F73928F90E008958FEF9FEF089586 :10138000FC01918D828D981731F0828DE80FF11D4F :10139000858D90E008958FEF9FEF0895FC01918D6A :1013A000228D892F90E0805C9F4F821B91098F7363 :1013B0009927089585EB94E00E94CE0921E0892BBE :1013C00009F420E0822F0895FC01848DDF01A80F2D :1013D000B11DA35ABF4F2C91848D90E001968F735D :1013E0009927848FA689B7892C93A089B1898C917C :1013F000837080648C93938D848D981306C00288CB :10140000F389E02D80818F7D80830895EF92FF9294 :101410000F931F93CF93DF93EC0181E0888F9B8D17 :101420008C8D981305C0E889F989808185FD26C0D7 :10143000F62E0B8D10E00F5F1F4F0F731127E02E5C :101440008C8DE8120CC00FB607FCFACFE889F98939 :10145000808185FFF5CFCE010E94E409F1CF8B8D0D :10146000FE01E80FF11DE35AFF4FF0829FB7F89499 :101470000B8FEA89FB89808180620AC09FB7F8944C :10148000EE89FF896083E889F989808183708064AF :1014900080839FBF81E090E0DF91CF911F910F91FA :1014A000FF90EF900895CF93DF93EC01888D882310 :1014B000C9F0EA89FB89808185FD05C0A889B989C1 :1014C0008C9186FD0FC00FB607FCF5CF808185FF9C :1014D000F2CFA889B9898C9185FFEDCFCE010E940A :1014E000E409E7CFDF91CF91089580E090E0892B68 :1014F00029F00E94DA0981110C940000089585ED0D :101500008093BC008091BC0084FDFCCF1092B40499 :10151000089540912604262F30E0240F311D2132FA :101520003105DCF42091B4042430C9F4FC0180E0DE :1015300090E0861758F4309126042191DC01AA5FCF :10154000BB4FA30FB11D2C930196F3CF80912604BE :10155000680F6093260480E0089581E0089582E09A :101560000895089508950895E0914A0480914904EA :10157000E81730F4F0E0E259FB4F808190E00895E5 :101580008FEF9FEF089590914A0480914904981736 :1015900050F4E92FF0E0E259FB4F208130E09F5FEB :1015A00090934A0402C02FEF3FEFC9010895809144 :1015B000490490E020914A04821B91090895CF923A :1015C000DF92EF92FF920F931F93CF93DF937C01F3 :1015D000CB018A0120914B04222389F0EB016B019E :1015E000C40ED51ECC15DD0569F06991D701ED91CA :1015F000FC910190F081E02DC7010995F3CF642F94 :101600000E94890AC801DF91CF911F910F91FF902D :10161000EF90DF90CF900895CF93DF931F92CDB7D7 :10162000DEB7698320914B042223D1F020916D0411 :10163000203240F021E030E0FC013383228380E05F :1016400090E015C080914C04E82FF0E0E35BFB4F85 :10165000998190838F5F80934C0480936D0405C0C3 :1016600061E0CE0101960E94890A81E090E00F902E :10167000DF91CF91089580E090E00895CF93DF93BC :10168000EC0160E08E810E947D1961E08E810E94F4 :101690007D1960E08E810E947D198BE891E00197B1 :1016A000F1F7DF91CF91089590912001891324C023 :1016B000EEE9F1E0E4919FEF90932001E130B9F081 :1016C00098F0E230C9F4909170009D7F9093700083 :1016D00091E09093B0009091B100987F94609093C6 :1016E000B1001092B30008C010926E0005C0909136 :1016F0006F009D7F90936F0060E00C947D196115E1 :10170000710579F0FB0101900020E9F73197AF01F5 :10171000461B570BDC01ED91FC910280F381E02D1B :10172000099480E090E008958F929F92AF92BF92CB :10173000EF92FF920F931F93CF93DF93CDB7DEB756 :10174000A1970FB6F894DEBF0FBECDBF7C01FA01A2 :10175000CB0119A2223008F42AE08E010F5D1F4F41 :10176000822E912CA12CB12CBF01A50194010E94C5 :101770000A26F901CA01015011096A3014F4605DAA :1017800001C0695CD8016C93232B242B252B61F7B6 :10179000B801C7010E947F0BA1960FB6F894DEBF77 :1017A0000FBECDBFDF91CF911F910F91FF90EF90B2 :1017B000BF90AF909F908F9008950C947F0B1F92D5 :1017C0000F920FB60F9211242F933F934F935F9375 :1017D0006F937F938F939F93AF93BF93EF93FF93F9 :1017E00085EB94E00E94E409FF91EF91BF91AF91E6 :1017F0009F918F917F916F915F914F913F912F9129 :101800000F900FBE0F901F9018951F920F920FB65A :101810000F9211242F938F939F93EF93FF93E09157 :10182000C504F091C6048081E091CB04F091CC0412 :1018300082FD12C090818091CE048F5F8F732091C2 :10184000CF04821751F0E091CE04F0E0EB54FB4F4F :10185000958F8093CE0401C08081FF91EF919F917D :101860008F912F910F900FBE0F901F9018950F938F :101870001F93CF93DF93EC018E8180FF02C08260C3 :1018800001C08D7F8E838C810E9454194D8150E060 :101890002E818417950711F42E7F01C021602E83BD :1018A0008E81282F30E0A9015595479524273527AB :1018B00020FF5FC00E94221A2F81222351F02D8920 :1018C0003E89621B730B898D9A8D6817790708F41E :1018D0007BC00E94221A6D8B7E8B8F8B988F8E819E :1018E00080FF13C08DA19EA101969EA38DA3EB8DB9 :1018F000FC8D309711F0CE0109950E94221A69875C :101900007A878B879C871FA230C0ED8DFE8D309724 :1019100011F0CE010995EF8DF8A1309711F0CE01AD :1019200009950E94221A2D853E85621B730B8A81C0 :101930009B818617970748F081E08887E9A1FAA183 :10194000309721F0CE01099501C0188689859A85C6 :10195000AB85BC858D879E87AF87B88B8FEF9FEF58 :10196000DC0189879A87AB87BC878E8184608E83F0 :101970002BC08B7F8E8389859A85AB85BC858F3FF5 :101980009F4FAF4FBF4F01F18FA181111DC00E942A :10199000221A09851A852B853C85AB01BC01401BA9 :1019A000510B620B730B88819981A0E0B0E0841722 :1019B0009507A607B70740F4EBA1FCA1309721F0EB :1019C000CE01099581E08FA3DF91CF911F910F91F7 :1019D0000895CF92DF92EF92FF920F931F93CF93D0 :1019E000DF936C017C0187E0E80EF11CC0E0D0E0E1 :1019F000062F10E0B8010C2E02C0759567950A9469 :101A0000E2F76170F70181917F010E947D192196B3 :101A1000C430D10579F7C601DF91CF911F910F91A5 :101A2000FF90EF90DF90CF900C943E0BCF92DF921F :101A3000EF92FF920F931F93CF93DF93EC01F62E5B :101A4000642F8C810E947D198D818F3F19F060E099 :101A50000E947D198F850F2D10E084FF25C06E0137 :101A600087E0C80ED11CE12CF12CB8010E2C02C06D :101A7000759567950A94E2F76170F60181916F019F :101A80000E947D19FFEFEF1AFF0A88E0E816F104C3 :101A900061F7CE01DF91CF911F910F91FF90EF90F1 :101AA000DF90CF900C943E0BB80184E0759567955C :101AB0008A95E1F7CE010E94E90C6F2DCE01DF91EE :101AC000CF911F910F91FF90EF90DF90CF900C94EA :101AD000E90C41E00E94160D81E090E008951F920C :101AE0000F920FB60F9211242F933F934F935F9352 :101AF0006F937F938F939F93AF93BF93EF93FF93D6 :101B00008091B900887F803609F49CC068F58832DE :101B100009F45BC090F4803109F454C038F4882390 :101B200009F4F6C0883009F44DC0F6C0883109F4D4 :101B30004CC0803209F45DC0EFC0803409F468C045 :101B400048F4803309F455C0883309F0E5C0809328 :101B5000B204D8C0803509F44FC0883509F45DC09F :101B6000883409F0D9C0D6C0883909F4C7C0A8F4B0 :101B7000883709F467C038F4883609F463C08037C1 :101B800009F460C0C9C0883809F4B8C0803909F4C4 :101B90005FC0803809F0C0C05BC0803B09F486C0DC :101BA00038F4803A09F466C0883A09F47FC0B4C0BA :101BB000803C09F4A7C0883C09F4A4C0883B09F420 :101BC0008AC0AAC08091AF0410C09091B1048091E6 :101BD000B004981770F5E091B10481E08E0F809306 :101BE000B104F0E0E257FB4F80818093BB0085ECAD :101BF00086C08093B2048EC0E091B10481E08E0F64 :101C00008093B1048091BB00F0E0E257FB4F8083EA :101C10009091B1048091B0046EC0E091B10481E074 :101C20008E0F8093B1048091BB00F0E0E257FB4F30 :101C300080838091B30481116DC081E08093AE04F4 :101C400084EA61C083E08093B40410924804CFCF4B :101C500080914804803208F051C0E091480481E04E :101C60008E0F809348048091BB00F0E0E85DFB4F4D :101C70008083BDCF85EC8093BC001092B40480912A :101C80004804803230F4E0914804F0E0E85DFB4F16 :101C900010826091480470E0E091DF03F091E0036E :101CA00088E294E009951092480436C084E080935D :101CB000B4041092270410922604E091E103F091FD :101CC000E203099580912604811105C081E080938B :101CD000260410920604E091270481E08E0F809381 :101CE0002704F0E0EA5FFB4F80818093BB00909176 :101CF000270480912604981708F479CF85E880930B :101D0000BC000AC085EC8093BC001092B40404C0EF :101D10001092B2040E947F0AFF91EF91BF91AF91A0 :101D20009F918F917F916F915F914F913F912F91F3 :101D30000F900FBE0F901F9018956AE00E94D62555 :101D4000292F30E1839FC0011124822B0895982F01 :101D50009695969596959E71292F220F220F920F98 :101D60008F70890F08951F93CF93DF9300D000D019 :101D700000D0CDB7DEB7182F823019F483E090E0A1 :101D800002C082E090E09093250180932401812F8E :101D90000E94921129833A834B835C836D8381E097 :101DA00078277E83612FCE0101960E946C140E94D9 :101DB000221A6093ED037093EE038093EF039093E8 :101DC000F00361E0812F0E94E40326960FB6F89499 :101DD000DEBF0FBECDBFDF91CF911F910895CF928F :101DE000DF92EF92FF92CF93DF9300D0CDB7DEB7B3 :101DF0001982BE016E5F7F4F81E10E94CB16BE014A :101E00006F5F7F4F82E10E94CB16698170E086E0B0 :101E1000759567958A95E1F7072E000C880B990B4D :101E20000E945E2320E030E040E85EE30E94BD2394 :101E30006B017C016A8170E080E090E00E945E238B :101E40009B01AC01C701B6010E94C224209126016A :101E5000222391F020E030E040E151E40E94BD23D4 :101E600020E030E040EA50E40E942E2520E030E0FF :101E700040E052E40E94C2240F900F90DF91CF9176 :101E8000FF90EF90DF90CF900895AF92BF92CF92E6 :101E9000DF92EF92FF920F931F93CF93DF93CDB713 :101EA000DEB72C970FB6F894DEBF0FBECDBF8C0106 :101EB0006B016FED71E00E940209CE0101967C0179 :101EC000B6019AE0C916D1040CF040C0CE010796C5 :101ED0000E9496186AEC73E0C7010E9402098B8584 :101EE0009C85AF80B884A114B10409F478C0009730 :101EF000B1F0CD80DE80C80ED91EB601C7010E94A8 :101F0000A308882309F46BC029813A818D819E81C1 :101F1000B501820F931F0E944D28DE82CD82E0160C :101F2000F10671F069817A816115710531F04D8199 :101F30005E81C8010E94DC0803C0C8010E94CA0873 :101F4000C7010E94FD08CE01079635C0C7010E9457 :101F50009618E016F10671F1F801808191810097E1 :101F6000B1F069817A816115710579F042815381FF :101F70002D813E814217530740F00E944D288D81EC :101F80009E81F8019583848313C00E94F026898185 :101F90009A81F801918380838B819C8193838283D2 :101FA0008D819E81958384831A8219821C821B8273 :101FB0001E821D82C7010E94FD08C8012C960FB623 :101FC000F894DEBF0FBECDBFDF91CF911F910F916F :101FD000FF90EF90DF90CF90BF90AF900895C70132 :101FE0000E94CA089CCFCF93C82F8091D8050E9429 :101FF000C1160E94FD16882311F080E030C0809148 :10200000D8050E94C11680E090E00E9400178C2F36 :1020100090E00E9400170E94FD168111EECF41E072 :1020200061E08091D8050E94231610924A048093A3 :10203000490440E050E080E02091490430E0909174 :102040004A04291B3109121613064CF4452B39F4A6 :1020500082E595E00E94C30A41E050E0EDCFCF91C8 :102060000895EF92FF920F931F93CF93DF93D82F92 :102070007B01C42F8091D7050E94C1166D2F82E588 :1020800095E00E940C0B80E00E946516D82F81110C :102090001CC06C2FC13208F060E241E08091D7058E :1020A0000E94231610924A0480934904C8130FC05B :1020B0008701F12CCF1561F082E595E00E94C30AFB :1020C000F80181938F01F394F5CFC0E001C0C82FD0 :1020D000F0E1DF9FC00111248C2BDF91CF911F9184 :1020E0000F91FF90EF900895FF920F931F93CF935E :1020F000DF93C82FF62E072F142F8091D7050E944B :10210000C1166C2F82E595E00E940C0BCF2DD02FCD :10211000CE01810F911D8C01C017D10731F069915B :1021200082E595E00E940C0BF7CF81E0DF91CF9123 :102130001F910F91FF900C946516CF93DF93D82FCA :10214000C62F8091D8050E94C1160E94FD168111EC :102150001BC08091D8050E94C11680E090E00E94CB :1021600000178D2F90E00E9400176C2F82E595E0FC :102170000E940C0B0E94FD166AE070E080E090E087 :10218000DF91CF910C94E819DF91CF910895CF9210 :10219000DF92EF92FF920F931F93CF93DF93CDB710 :1021A000DEB72B970FB6F894DEBF0FBECDBF182F4A :1021B000813011F08AE001C087E044E0BE01695F30 :1021C0007F4F0E943110123009F41F828F818F7768 :1021D0000E94A70EC82E88858F770E94A70ED82E42 :1021E000898586FF08C085FB002700F98F710E9452 :1021F000A70EF82E05C08F730E94A70EF82E02E0DE :1022000088E00E94F30F113029F090E095958795B2 :102210009595879583708B87EB84BE01655F7F4FB3 :102220008EE00E94CB167B85113011F4717002C0D4 :102230007695717096014F2D5E2D602F80E090E0B5 :102240002B960FB6F894DEBF0FBECDBFDF91CF91B6 :102250001F910F91FF90EF90DF90CF900895CF9254 :10226000DF92EF92FF920F931F93CF93DF9300D0F3 :1022700000D000D0CDB7DEB7082F813041F480E028 :102280000E94F30F0E94A70ED82E81E002C0D12C2D :1022900084E00E94F30F0E94A70EC82E013011F0B7 :1022A00085E001C082E00E94F30F86FF08C085FB35 :1022B000FF24F0F88F710E94A70EE82E06C08F73DE :1022C0000E94A70EE82E32E0F32E88E00E94F30F62 :1022D000013029F090E09595879595958795182F71 :1022E000137087E00E94F30F013019F4782F71709A :1022F00003C081FB772770F92D2D3C2D4E2D512FDA :102300006F2D80E090E026960FB6F894DEBF0FBEEA :10231000CDBFDF91CF911F910F91FF90EF90DF9094 :10232000CF900895CF93DF93CDB7DEB762970FB606 :10233000F894DEBF0FBECDBF813019F0823029F195 :1023400035C08091DA05882321F081E00E942F11A9 :1023500003C081E00E94C7102F83388749875A87BE :102360006B877C8786E0FE013796DE01119601902F :102370000D928A95E1F786E0FE013196DE011D9609 :1023800001900D928A95E1F711C08091DB058823B9 :1023900021F082E00E942F1103C082E00E94C7104A :1023A0002D873E874F87588B698B7A8B86E0FE019D :1023B0003D96DE01179601900D928A95E1F72F81E7 :1023C000388549855A856B857C8580E090E06296EA :1023D0000FB6F894DEBF0FBECDBFDF91CF91089549 :1023E000AF92BF92CF92DF92EF92FF920F931F9323 :1023F000CF93DF93CDB7DEB72F970FB6F894DEBF3C :102400000FBECDBF47E0BE01675F7F4F80E00E94F7 :10241000311089850E94A70EA82E8A850E94A70EDA :10242000B82E8B8586FF08C085FB112710F98F71A8 :102430000E94A70EF82E05C08F730E94A70EF82EDB :1024400012E08C850E94A70EC82E8D850E94A70ED3 :10245000D82E8E8587FD02C000E001C004E68F7192 :102460000E94A70EE82E8F850E94A70E95014F2D82 :102470005C2D6D2D7E2D800F912F2F960FB6F89429 :10248000DEBF0FBECDBFDF91CF911F910F91FF90A7 :10249000EF90DF90CF90BF90AF900895EF92FF92B2 :1024A0000F931F93CF93DF93CDB7DEB728970FB667 :1024B000F894DEBF0FBECDBF182FE62EF42E022FEC :1024C0000E94F011242F852F60E177E2969FA001F2 :1024D000979F500D112494E6299F400D511D112402 :1024E000430F511DE69E9001E79E300D112494E6A6 :1024F000F99E200D311D1124200F311D4217530765 :1025000074F4113021F008F11230F9F405C09EEF97 :10251000980F953078F419C08130B1F416C011309D :1025200031F068F0123041F0133049F00EC08F5F87 :10253000873058F082E009C0873030F003C08F5FE9 :10254000883019F481E001C087E028960FB6F8942E :10255000DEBF0FBECDBFDF91CF911F910F91FF90D6 :10256000EF9008958F929F92AF92BF92CF92DF9299 :10257000EF92FF920F931F93CF93DF9300D01F92A0 :10258000CDB7DEB78C01A62E21E0621309C0FC0195 :1025900080810E949D0E8983682F80E00E949D109B :1025A000F801E1808E2D0E949D0E8983F801F48050 :1025B000F2E0FF1206C0F80182810E949D0E8F7327 :1025C0000DC0F8018281F11005C00E949D0E8F712F :1025D000806404C00E949D0E8F7180668A832E2DB8 :1025E000F80142816F2D83810E944E120E949D0E40 :1025F000F8019381911102C0806801C080648B83CF :10260000F1E0AF1619F094E0B92E02C0BB24B394E8 :10261000812C912C83E0C82ED12C6091E205E62E0E :10262000F12C8B2D0E94D625E91AF108C6012FE165 :10263000C216D10414F08EE190E08E159F050CF4C3 :102640007C018091D8050E94C1160E94FD1681115F :1026500020C08091D8050E94C11680E090E00E94C1 :1026600000178B2D90E00E94001743E050E061E0DE :1026700070E06C0F7D1F680D791D82E595E00E946A :10268000DF0A0E94FD166AE070E080E090E00E94A0 :10269000E819CE18DF088E0C9F1CBE0C1C141D04FC :1026A0000CF4BBCF87E00E94F30F982F9770F801CE :1026B0002581F1E0AF1206C0222311F0916005C020 :1026C000867006C0222319F09260998302C085703B :1026D0008983698187E00E949D1081E00F900F90AF :1026E0000F90DF91CF911F910F91FF90EF90DF90AE :1026F000CF90BF90AF909F908F900895CF93DF932E :10270000D82FC62F8091D7050E94C1166D2F82E564 :1027100095E00E940C0B6C2F82E595E00E940C0B5B :1027200081E0DF91CF910C946516CF93DF931F92D8 :10273000CDB7DEB7BE016F5F7F4F8EE00E94CB1634 :10274000898187FF04C091E09093DC0502C010925C :10275000DC0586FF04C091E09093DD0502C0109275 :10276000DD0585FF04C091E09093DE0502C0109264 :10277000DE0584FF04C091E09093DF0502C0109253 :10278000DF0583FF04C091E09093E00502C0109242 :10279000E00582FF04C091E09093E10502C0109231 :1027A000E1050F90DF91CF910895DF92EF92FF92B4 :1027B0000F931F93CF93DF9300D01F92CDB7DEB757 :1027C0008C01F62E21E062130AC0FC0180818F7714 :1027D0000E949D0E8983682F87E00E947E13F80176 :1027E000D1808D2D8F770E949D0E8983F801E48022 :1027F000F2E0EF1206C0F80182810E949D0E8F73F5 :102800000DC0F8018281E11005C00E949D0E8F75F8 :10281000806404C00E949D0E8F7780668A832D2D70 :10282000F80142816E2D83810E944E120E949D0EFE :10283000F8019381911102C0806801C080648B838C :10284000F1E0FF1202C088E001C08BE043E0BE016E :102850006F5F7F4F0E94741088E00E94F30FF801B1 :102860009381F1E0FF1204C0282F2C7F292B06C092 :1028700044E0949F90011124837F282B2983698150 :1028800088E00E949D10F80115810E949513682F21 :1028900081E08093E105F81621F0F2E0FF1639F0AF :1028A0000FC0112311F0656008C06E7F05C01123B1 :1028B00011F0666002C06D7F64608EE00E947E133E :1028C00081E00F900F900F90DF91CF911F910F91AA :1028D000FF90EF90DF900895CF93DF93EC0161308C :1028E00039F0623071F462E00E94D51362E004C0F6 :1028F00061E00E94D51361E0CE01DF91CF910C948D :10290000B21282E0DF91CF910895CF93DF93BC01A3 :1029100085EB94E00E947F0BEC016DED71E085EB9F :1029200094E00E947F0B8C0F9D1FDF91CF91089543 :10293000CF92DF92EF92FF920F931F93CF93DF938B :10294000CDB7DEB727970FB6F894DEBF0FBECDBF69 :102950008C01FC01F680D480E5802F2D30E02053DF :10296000384F81E090E0F2E0FE1510F480E090E056 :10297000281B390BEE2DF0E0EE0FFF1FEB59FE4F39 :102980000190F081E02DE20FF31FED0DF11DB90173 :102990007695679576956795E60FF71FC90160E90B :1029A00071E00E94E225E60FF71FC90164E670E0BE :1029B0000E94E225CF01861B970B67E070E00E9422 :1029C000E225CC24C394C80EF80180810E949D0E9C :1029D0008983F80181810E949D0E8A83F801878195 :1029E000823029F482810E949D0E8F730EC0F801FF :1029F000811106C082810E949D0E8F75806405C082 :102A000082810E949D0E8F7780668B838C2D0E9421 :102A10009D0E8C838D2D0E949D0E8D83F3E68E2D51 :102A2000FF1528F00E949D0E8E838F2D06C00E94F8 :102A30009D0E80688E838CE98F0D0E949D0E8F8382 :102A400047E0BE016F5F7F4F80E00E9474102796C1 :102A50000FB6F894DEBF0FBECDBFDF91CF911F91AF :102A60000F91FF90EF90DF90CF9008951F93CF9339 :102A7000DF93EC01862F6C8360E00E94AC1911E0BB :102A80001F838EE190E09A8F898F0E94221A6D8BAE :102A90007E8B8F8B988F1D8361E08C810E947D19C6 :102AA0001E828D81811101C01E831C8E1B8E1E8E85 :102AB0001D8E18A21F8E1AA219A21CA21BA21D866F :102AC0001E861F86188A1EA21DA281E08FA318866B :102AD000DF91CF911F91089540E0682F83EE95E03C :102AE0000C94160D81E00E946C158BE39FE1019719 :102AF000F1F70895E3EEF5E08089982F9460908BCC :102B00008C600C946C15CF93DF93823028F09091F9 :102B1000F20598609093F2058093F6051092F70500 :102B200080E48093F80580E18093F90580E5809347 :102B3000FA0561E08091E7050E94AC198091E805F3 :102B40008F3F19F061E00E94AC1961E08091E905C6 :102B50000E94AC19C3EED5E09E01235E3540809102 :102B6000F20584FD03C084E090E002C088E090E0BC :102B70002196281739072CF461E08E810E94AC1948 :102B8000EBCF8BE39DE00197F1F760E08091E705E3 :102B90000E947D1960E08091E9050E947D19809175 :102BA000E8058F3F19F060E00E947D198091F205E1 :102BB00084FD20C063E083EE95E00E94E90CCBE445 :102BC000D6E4CE010197F1F763E083EE95E00E9431 :102BD000E90C2197F1F763E083EE95E00E94E90CA0 :102BE00083E592E00197F1F762E083EE95E00E94C1 :102BF000E90C15C080620E946C158BE496E4019785 :102C0000F1F78091F20580620E946C1583E592E0F5 :102C10000197F1F78091F20580620E946C15809116 :102C2000F20580620E946C1584E08093F3050E9497 :102C30007A150E94721582E08093F40586E0DF9198 :102C4000CF910C946C159091B4049111FCCF91E04C :102C50009093B4044093B3042FEF2093B2041092E6 :102C6000B104260F2093B0049093AF049091AF0469 :102C7000880F892B8093AF048091AE04813061F47A :102C80001092AE048091AF048093BB008091BC0091 :102C900083FDF8CF85EC01C085EE8093BC00809168 :102CA000B4048130E1F38091B104861710F460918F :102CB000B104AEE8B4E0EEE6F4E080E0861721F07F :102CC0009D9191938F5FFACF0895282F30916D04D5 :102CD000313208F04AC08091B4048111FCCF909148 :102CE000FB0542E04093B4042093B3042FEF2093FC :102CF000B2041092B1043093B004EDE4F4E0AEE815 :102D0000B4E020E0321721F041914D932F5FFACFCC :102D10001092AF042091AF04990F922B9093AF04BF :102D20009091AE04913061F41092AE049091AF0492 :102D30009093BB009091BC0093FDF8CF95EC01C03F :102D400095EE9093BC009091B4049230E1F3909191 :102D5000B2049F3F79F08091B204803241F08091BB :102D6000B204803331F084E005C081E003C082E02A :102D700001C083E010924C0410926D0410924B0439 :102D8000089591E090934B048093FB0510924C04BE :102D900010926D0408950F931F93CF93DF93C82F64 :102DA0008B018091D7050E94C1166C2F82E595E0BA :102DB0000E940C0B80E00E946516C82F811112C082 :102DC00041E061E08091D7050E942316D82F109230 :102DD0004A048093490482E595E00E94C30AF80101 :102DE000808301C0D0E0F0E1CF9FC00111248D2B82 :102DF000DF91CF911F910F91089581E00C9465169A :102E0000682F82E595E00C940C0B833081F028F458 :102E1000813099F08230A1F008958730A9F0883090 :102E2000B9F08430D1F4809180008F7D03C080910F :102E300080008F7780938000089584B58F7702C0DB :102E400084B58F7D84BD08958091B0008F7703C0D5 :102E50008091B0008F7D8093B00008953FB7F894C3 :102E60008091010690910206A0910306B09104069C :102E700026B5A89B05C02F3F19F00196A11DB11DD5 :102E80003FBFBA2FA92F982F8827820F911DA11D10 :102E9000B11DBC01CD0142E0660F771F881F991F4D :102EA0004A95D1F708951F93CF93DF93CDB7DEB73F :102EB00028970FB6F894DEBF0FBECDBF182F0E9423 :102EC000F01129833A834B835C836D838F839887CA :102ED000872F90E0112329F001968D3091055CF445 :102EE0000CC001978D30910534F4181619062CF09A :102EF0008CE090E002C081E090E08E83CE010196EC :102F00000E94981428960FB6F894DEBF0FBECDBF6E :102F1000DF91CF911F9108951F93CF93DF93CDB78A :102F2000DEB728970FB6F894DEBF0FBECDBF182FBF :102F30000E94F01129833A834B835C837E838F83C5 :102F40009887262F30E0763051F028F4723049F01F :102F50007430A9F404C0793011F07B3081F48EE133 :102F600013C040ED480F842F837059F4842F64E61A :102F70000E94D625911107C0442329F002C08FE199 :102F800003C08CE101C08DE190E0B901112319F07B :102F90006F5F7F4F06C061507109161617060CF05F :102FA000BC018617970714F461E070E06D83CE01D1 :102FB00001960E94981428960FB6F894DEBF0FBEB3 :102FC000CDBFDF91CF911F9108951F93CF93DF93D2 :102FD000CDB7DEB728970FB6F894DEBF0FBECDBFD2 :102FE000182F0E94F01129833A834B835C836D83F1 :102FF0007E83988790E0112311F0019601C001971C :103000008231910534F0883C91052CF082E190E00A :1030100002C087EC90E08F83CE0101960E94981445 :1030200028960FB6F894DEBF0FBECDBFDF91CF91CB :103030001F9108951F93CF93DF93CDB7DEB72797E6 :103040000FB6F894DEBF0FBECDBF182F8130C1F090 :10305000823009F04EC081E08093DB0582E00E945F :10306000C71029833A834B835C836D837E83BE01C3 :10307000695F7F4F8FE00E94CB166F816D7F13C019 :103080008093DA0581E00E94C71029833A834B833D :103090005C836D837E83BE01695F7F4F8FE00E94FA :1030A000CB166F816E7F6F838FE00E947E138A81C3 :1030B000875F8C3318F09B819F5F9B836CE30E943A :1030C000D6259A839D818B81923041F02CE0622F2E :1030D0000E94D625911105C02B8304C068E10E948F :1030E000D6259B83612FCE0101960E94D51381E0E6 :1030F00001C082E027960FB6F894DEBF0FBECDBFA9 :10310000DF91CF911F910895643008F063E09091B2 :10311000F605691710F06FEF690FE62FF0E0ED513B :10312000FA4F9489890F80680C946C15EF92FF9286 :103130000F931F93CF93DF93CDB7DEB762970FB690 :10314000F894DEBF0FBECDBF8C01CB01F801118218 :10315000108213821282158214824AE09E012F5F30 :103160003F4F7901B9010E94F020F7010190002042 :10317000E9F73197AF014E195F09B701C8010E9405 :10318000DC0862960FB6F894DEBF0FBECDBFDF91AC :10319000CF911F910F91FF90EF900895FC01448112 :1031A00055816081718183EE95E00C947309CF9312 :1031B000DF931F92CDB7DEB7BE016F5F7F4F8FE009 :1031C0000E94CB1669816F7769838FE00E947E131E :1031D0000F90DF91CF910895E3EEF5E080898E7F27 :1031E000808B88600C946C15E3EEF5E080898D7F10 :1031F000808B88600C946C15CF93DF9300D000D047 :1032000000D0CDB7DEB719821A8296E09B8391E099 :103210009C831D821E82682FCE0101960E946C1431 :1032200026960FB6F894DEBF0FBECDBFDF91CF91CB :103230000895CF93DF9300D000D000D0CDB7DEB794 :103240009FEF980F923048F40E942F1181E04D308B :1032500010F4411103C0623009F080E026960FB6E9 :10326000F894DEBF0FBECDBFDF91CF9108950F93CD :103270001F93CF93DF938B01877028E0829FC0015B :10328000112480640E946C15E801085F1F4F69914A :1032900083EE95E00E94690DC017D107C1F7DF9159 :1032A000CF911F910F910895CF93DF93282F30E096 :1032B000F901EB51FE4F8491F901EF52FE4FD49189 :1032C000F901E354FE4FC491CC2391F081110E9487 :1032D0000517EC2FF0E0EE0FFF1FED54FE4FA59108 :1032E000B491EC91ED2381E090E021F480E002C004 :1032F00080E090E0DF91CF9108951F93CF93DF930B :10330000282F30E0F901EB51FE4F8491F901EF5283 :10331000FE4FD491F901E354FE4FC491CC23C1F088 :10332000162F81110E940517EC2FF0E0EE0FFF1F02 :10333000E755FE4FA591B4919FB7F894111104C0C1 :103340008C91D095D82302C0EC91DE2BDC939FBFEB :10335000DF91CF911F910895CF93DF9390E0FC010F :10336000EF52FE4F2491FC01E354FE4F84918823D9 :1033700061F190E0880F991FFC01E156FE4FC59165 :10338000D491FC01E755FE4FA591B491611109C09C :103390009FB7F8948881209582238883EC912E230F :1033A0000BC0623061F49FB7F8948881322F30955A :1033B00083238883EC912E2B2C939FBF06C08FB75D :1033C000F894E8812E2B28838FBFDF91CF91089549 :1033D0008F929F92AF92BF92CF92DF92EF92FF9225 :1033E0006B017C010E942E174B015C01C114D104BA :1033F000E104F104F1F00E942E17DC01CB018819E1 :103400009909AA09BB09883E9340A105B10570F34B :1034100021E0C21AD108E108F10888EE880E83E0A5 :10342000981EA11CB11CC114D104E104F10419F7C8 :10343000DDCFFF90EF90DF90CF90BF90AF909F9047 :103440008F9008952FB7F8946091FD057091FE0557 :103450008091FF05909100062FBF08951F920F9253 :103460000FB60F9211242F933F938F939F93AF9397 :10347000BF938091FD059091FE05A091FF05B0914D :1034800000063091FC0523E0230F2D3720F4019630 :10349000A11DB11D05C026E8230F0296A11DB11D77 :1034A0002093FC058093FD059093FE05A093FF05F6 :1034B000B09300068091010690910206A091030648 :1034C000B09104060196A11DB11D80930106909351 :1034D0000206A0930306B0930406BF91AF919F919B :1034E0008F913F912F910F900FBE0F901F901895C5 :1034F000CF93DF93CDB7DEB769970FB6F894DEBFF1 :103500000FBECDBF789484B5826084BD84B58160E0 :1035100084BD85B5826085BD85B5816085BD80919E :103520006E00816080936E00109281008091810016 :10353000826080938100809181008160809381000E :10354000809180008160809380008091B1008460D0 :103550008093B1008091B00081608093B000809131 :103560007A00846080937A0080917A0082608093F0 :103570007A0080917A00816080937A0080917A004D :10358000806880937A001092C1000E94221A609392 :10359000E7037093E8038093E9039093EA03E091D3 :1035A000C504F091C60482E08083E091C104F091EB :1035B000C2041082E091C304F091C4048FEC8083B4 :1035C0001092CD04E091C904F091CA0486E0808392 :1035D000E091C704F091C804808180618083E0910C :1035E000C704F091C804808188608083E091C7049B :1035F000F091C804808180688083E091C704F091D5 :10360000C80480818F7D808383EB92E00E948514C3 :1036100061E08DE00E94AC1960E08DE00E947D19B0 :1036200061E08CE00E94AC1960E08CE00E947D19A2 :1036300082E00E94831568E171E081E00E94371901 :1036400060E171E082E00E94371968E071E083E098 :103650000E94371960E071E084E00E9437191092EF :103660004A041092490410924C0410926D04109276 :10367000B40481E08093B3041092AE0461E082E16F :103680000E947D1961E083E10E947D198091B9005B :103690008E7F8093B9008091B9008D7F8093B900AF :1036A00088E48093B80085E48093BC0081EB9AE0C5 :1036B0009093E2038093E10382EB9AE09093E0031E :1036C0008093DF030E949513682F64608EE00E9450 :1036D0007E130E9495131092DA051092DB05BE014D :1036E000615F7F4F85E00E94CB168F8587FD02C00A :1036F00010E001C014E6BE01615F7F4F86E00E94CA :10370000CB168F850E94A70E810F8231D0F41982CB :103710001A828CE08B8382E08C8381E08D838E83A0 :1037200082E18F831886CE0101960E9498146CE185 :103730008EE00E947E130E94951381E00E94FC1887 :103740002BC081E00E941919882379F081E00E9442 :103750002F1129833A834B835C836D837E8361E0E1 :10376000CE0101960E946C1403C081E00E94FC18F7 :1037700082E00E941919882379F082E00E942F11BB :1037800029833A834B835C836D837E8362E0CE0121 :1037900001960E946C1403C082E00E94FC18BE01D6 :1037A0006F5F7F4F8FE00E94CB16898187FF08C033 :1037B00010922501109224018FEB92E00E94851453 :1037C0000E94EF0E6093E3037093E4038093E5039C :1037D0009093E6034FE657E05093A7054093A60564 :1037E00028EB3BE0309388052093870580E696E040 :1037F0009093AB058093AA0550937F0540937E0577 :103800003093600520935F05909383058093820534 :103810005093CF054093CE053093B0052093AF056C :103820009093D3058093D20581E00E94A3046FECAE :1038300072E085EB94E00E94DD0B0E949513482F07 :1038400050E060E070E022E085EB94E00E94940B91 :103850006DED71E085EB94E00E947F0B60EE72E00D :1038600085EB94E00E94DD0BBE016F5F7F4F8FE020 :103870000E94CB16498150E060E070E022E085EBC9 :1038800094E00E94940B6DED71E085EB94E00E9452 :103890007F0B81EF92E00E948514E0912401F0916A :1038A0002501E830F10508F02CC3E65BFF4F80915D :1038B0002201909123010C944B26892B61F08BEF10 :1038C00092E00E94851480912401909125019093AB :1038D00023018093220180E00E94A3040E94221A07 :1038E000C0900204D0900304E0900404F09005041A :1038F000DC01CB018C199D09AE09BF09883E9340BC :10390000A105B10508F404C30E94221A60930204C1 :103910007093030480930404909305041091210193 :10392000112349F08091F3058B7F8093F305886024 :103930000E946C1502C00E947A1581E0182710932E :103940002101E6C2019709F4E0C282E193E00E94FE :1039500085148091240190912501909323018093F7 :103960002201D3C2029761F089E293E00E9485149C :10397000809124019091250190932301809322014D :103980000E94221AC090ED03D090EE03E090EF0366 :10399000F090F003DC01CB018C199D09AE09BF0941 :1039A000813D9740A105B10528F591C2039761F0CB :1039B00081E493E00E948514809124019091250177 :1039C00090932301809322010E94221AC090ED035C :1039D000D090EE03E090EF03F090F003DC01CB0118 :1039E0008C199D09AE09BF09813D9740A105B1051C :1039F00008F484C281E090E0909325018093240133 :103A000085C2049761F089E593E00E948514809156 :103A1000240190912501909323018093220180E05D :103A20000E94A3040E94221AC0900204D0900304B2 :103A3000E0900404F0900504DC01CB018C199D0991 :103A4000AE09BF09883E9340A105B10508F460C2E4 :103A50000E94221A6093020470930304809304046A :103A60009093050410912101112349F08091F305F1 :103A70008B7F8093F30588600E946C1502C00E94C2 :103A80007A1581E01827109321018DE00E945419C6 :103A900061E0892B09F060E08DE00E947D198DE5E1 :103AA00091E0998B888BA3E5B1E0BF8BAE8BE88961 :103AB000F98961917191F98BE88B88EE93E00E940E :103AC000F625798F688FCB01092E000CAA0BBB0B52 :103AD0008A8B9B8BAC8BBD8BAE89BF892D903D9023 :103AE000BF8BAE8B809120018C3021F08F3F09F08D :103AF00088C104C0EEE9F1E0149172C08CE08093BB :103B00002001EEE9F1E014911F3F09F47AC1113070 :103B100009F442C038F1123009F062C01092B000CE :103B20001092B1008091B00082608093B0008091CB :103B3000B10081608093B100E9ECF1E08491E82F5D :103B4000F0E0EE0FFF1FE755FE4F859194919093A3 :103B5000F3038093F203EDEDF1E084918093F103A0 :103B600012E0A4C214BC15BC84B5826084BD85B5C6 :103B7000816085BDE9ECF1E08491E82FF0E0EE0F83 :103B8000FF1FE755FE4F85919491EDEDF1E0849193 :103B90008093F50310E08AC2109280001092810099 :103BA0008091810088608093810080918100816094 :103BB00080938100E9ECF1E08491E82FF0E0EE0FD2 :103BC000FF1FE755FE4F85919491EDEDF1E0849153 :103BD0008093F40361E08CE00E94AC1911E084C092 :103BE00017FD0FC161E08CE00E94AC19812F8D7F21 :103BF00009F07AC04101A12CB12C60E072E18AE7A2 :103C000090E0A50194010E942C2629013A01690146 :103C10007A01F1E0CF1AD108E108F1082FEFC216BE :103C2000D104E104F10409F008F44CC060E472E44A :103C30008FE090E0A50194010E942C2669017A0191 :103C400081E0C81AD108E108F108123009F59FEFA8 :103C5000C916D104E104F10409F008F4F0C160E9E7 :103C600070ED83E090E0A50194010E942C2669018B :103C70007A01A1E0CA1AD108E108F108BFEFCB161A :103C8000D104E104F10411F008F068C183E025C01B :103C9000EFEFCE16D104E104F104B1F0A8F068E42E :103CA00078EE81E090E0A50194010E942C26690144 :103CB0007A01F1E0CF1AD108E108F108112309F4E3 :103CC000C0C18BC181E001C082E0111106C095B571 :103CD000987F892B85BD46C085E09091B100987F83 :103CE000892B8093B1003EC04101A12CB12C60E032 :103CF00072E18AE790E0A50194010E942C266901F7 :103D00007A01B1E0CB1AD108E108F108C114D1045D :103D1000E1E0EE06F10488F068E478EE81E090E0FE :103D2000A50194010E942C2669017A01F1E0CF1AC5 :103D3000D108E108F10883E001C081E0113091F47D :103D400090918100987F892B809381008A899B893B :103D5000AC89BD89892B8A2B8B2B61F42FEF3FEF28 :103D6000A9012EC08A899B89AC89BD89892B8A2BA0 :103D70008B2B71F09101220F331FA88DB98D0E94FA :103D8000512628EE33E040E050E00E940A2603C0AE :103D90002FEF3FEFA901113099F0123019F11111F5 :103DA00030C0C7BC2093FE033093FF034093000450 :103DB0005093010480916E00826080936E0021C058 :103DC000D0928900C09288002093FA033093FB03BD :103DD0004093FC035093FD0380916F0082608093B9 :103DE0006F000FC0C092B3002093F6033093F70327 :103DF0004093F8035093F9038091700082608093A0 :103E000070006A897B898C899D890E945E2326E6E1 :103E100036E646EA5FE30E94BD230E94A025072EF6 :103E2000000C880B990B0E94E8198CE00E94540B3F :103E3000A889B989A756B14009F039CE69C005975C :103E400061F08CE693E00E948514809124019091AA :103E5000250190932301809322018091EC039EE041 :103E6000E5E4F1E0DE01119601900D929A95E1F7FB :103E7000FE013196E80FF11DE80FF11D618180818F :103E80000E9484188091F305982F92609093F30517 :103E90008A600E946C158091F305982F9160909331 :103EA000F30589600E946C1530C0069761F083E8C5 :103EB00093E00E94851480912401909125019093B4 :103EC0002301809322018091EC030E94A90360E00A :103ED00081E00E94E4031CC0079761F08BE993E046 :103EE0000E948514809124019091250190932301D3 :103EF000809322018091EC030E94A90360E082E09C :103F0000E8CF83EB93E00E94851480E00E94A30435 :103F100087E895E00E94370C8FE595E00E94370C0A :103F20008FEA95E00E94370C82E00E9454197C01D0 :103F30001982BE016F5F7F4F8FE00E94CB1689818F :103F40008370EF2831F424E030E030932501209392 :103F500024018093EB030E94750A9FCC68E478EEFD :103F600081E090E0A50194010E942C2669017A016C :103F7000F1E0CF1AD108E108F1082FEFC216D10401 :103F8000E104F10441F138F164E274EF80E090E083 :103F9000A50194010E942C2669017A0181E0C81ACA :103FA000D108E108F1089FEFC916D104E104F1043A :103FB00009F008F491CE62E17AE780E090E0A50193 :103FC00094010E942C2669017A01A1E0CA1AD10845 :103FD000E108F10819C084E080CEEFEFCE16D104DD :103FE000E104F10409F008F45FC062E17AE780E0DF :103FF00090E0A50194010E942C2669017A01B1E0AC :10400000CB1AD108E108F1082FEFC216D104E10460 :10401000F10499F090F0D301C2012AE0B595A7957B :10402000979587952A95D1F76C017D01F1E0CF1A1C :10403000D108E108F10887E050CE86E04ECE82E05C :104040004CCEAFEFCA16D104E104F10459F150F19E :1040500062E17AE780E090E0A50194010E942C26BD :1040600069017A0181E0C81AD108E108F1089FEFDF :10407000C916D104E104F10499F090F0D301C20112 :104080003AE0B595A795979587953A95D1F76C0144 :104090007D01E1E0CE1AD108E108F10885E017CEF4 :1040A00084E015CE83E013CE84E00FCE61E08CE097 :1040B0000E94AC199FCDE5EBF4E01382128288EEEA :1040C00093E0A0E0B0E084839583A683B78323E8E0 :1040D00031E03183208325EC30E03587248724ECE0 :1040E00030E03787268720EC30E0318B208B21ECC5 :1040F00030E0338B228B22EC30E0358B248B26ECA6 :1041000030E0378B268B118E128E138E148EE2E5E3 :10411000F5E01382128284839583A683B78385E9B1 :1041200091E091838083E3EEF5E01382128287EAC7 :1041300091E09183808383E084838FEF858384E0A3 :10414000868385E0878386E0808787E0818788E0B3 :1041500082871386148615861686178681E00E944C :104160008315E7EDF5E081E0828390E2938798E69E :10417000908397E5918382876BE08FEA95E00E94B8 :10418000361569E087E895E00E9436156AE08FE50C :1041900095E00E9436158091260180935E05089572 :1041A000EF920F931F93CF93DF93E80147FD02C077 :1041B00034E001C034E1042E000C550B57FF03C05E :1041C000519541955109E32E022F242FAE010E94F3 :1041D0001521CE01DF91CF911F910F91EF9008959E :1041E000BB274A3031F4992322F4BDE290958195A2 :1041F0009F4F0C94FC20BB27FB015527AA27880F53 :10420000991FAA1FA41710F0A41B83955051B9F74A :10421000A05DAA3308F0A95DA193009779F7B111C9 :10422000B1931192CB010C944723A9E0B0E0EBE1EC :10423000F1E20C9481246A01122FB02E2BE3201797 :1042400020F0FF24F394F00E02C02CE3F22E0F2D89 :1042500027E0AE014F5F5F4F0E946F22BC01498192 :10426000842F8970813031F0E1FC06C0E0FE06C089 :1042700090E205C09DE203C09BE201C090E05E2D8C :10428000507143FF3CC0911102C083E001C084E043 :10429000811718F4212F281B01C020E051110BC0F9 :1042A000F601822F30E2882319F031938150FBCF41 :1042B000C20ED11C20E0992329F0D6019C93F6016F :1042C00031966F01C6010396E2FE0AC03EE4D601B4 :1042D0003C9341E411964C93119712963C9306C07F :1042E0003EE6F601308341E641833283FC01322F02 :1042F00040E2332309F442C041933150FACF42FFE8 :1043000044C0911102C083E001C084E0811718F419 :10431000212F281B01C020E051110BC0F601822F74 :1043200030E2882319F031938150FBCFC20ED11CAB :1043300020E0992329F0D6019C93F60131966F0174 :10434000C6010396E2FE0BC039E4D6013C933EE47D :1043500011963C93119736E412963C9307C039E6C8 :10436000F60130833EE6318336E63283FC01322F9C :1043700040E2332319F041933150FBCFFC01E20FAF :10438000F11D10828EEF9FEFA6C021E030E0911169 :1043900002C020E030E0161617061CF4FB0131962F :1043A00002C0E1E0F0E02E0F3F1FBB2021F0EB2D1B :1043B000F0E0319602C0E0E0F0E02E0F3F1FE12F69 :1043C000F0E02E173F071CF4121B212F01C020E044 :1043D0008E2D887159F4F601822F30E2882319F06E :1043E00031938150FBCFC20ED11C20E0992329F0DC :1043F000D6019C93F60131966F0151110BC0F60165 :10440000822F90E3882319F091938150FBCFC20E45 :10441000D11C20E00F2D060F9A81342F307144FFFC :1044200003C0913309F40150101624F4093018F038 :1044300008E001C001E0AB0177FF02C040E050E0BE :10444000FB01E41BF50BA1E0B0E0AC0FBD1FEA0FD0 :10445000FB1F8EE2A82E4B01801A91080B2D10E055 :104460001195019511094F3FBFEF5B0721F4D6016C :10447000AC9211966D01641775072CF084169506A1 :1044800014F4818101C080E3415051093196D60175 :1044900011967D014017510724F0D6018C936701D6 :1044A000E2CF6417750739F4963320F4953319F485 :1044B000311101C081E3F6018083F701822F90E280 :1044C000882319F091938150FBCFF701E20FF11D82 :1044D000108280E090E02996ECE00C949D24283036 :1044E00008F027E03327DA01990F311D87FD91602D :1044F00000966105710539F432602E5F3D9330E31B :104500002A95E1F708959F3F30F0803871056105E5 :1045100009F03C5F3C5F3D93913008F08068911D4D :10452000DF93CF931F930F93FF92EF92192F987FF2 :104530009695E92F96959695E90FFF27E250FF4F44 :1045400099273327EE24FF24A701E701059008945B :10455000079428F4360FE71EF81E491F511D660FF9 :10456000771F881F991F0694A1F70590079428F4D8 :10457000E70EF81E491F561FC11D770F881F991F90 :10458000661F0694A1F70590079428F4F80E491FBA :10459000561FC71FD11D880F991F661F771F0694CE :1045A000A1F70590079420F4490F561FC71FD81F85 :1045B000990F661F771F881F0694A9F7849110959D :1045C000177041F0D695C79557954795F794E7949E :1045D0001A95C1F7E4EAF0E06894159015913591C9 :1045E0006591959105907FE27395E118F10A430B6F :1045F000560BC90BD009C0F7E10CF11E431F561F23 :10460000C91FD01D7EF4703311F48A95E6CFE8946B :10461000015030F0080F0AF40027021708F4202F89 :104620002395022F7A3328F079E37D932A95E9F7D1 :1046300010C07D932A9589F60694979567953795CE :1046400017951794E118F10A430B560BC90BD009C3 :1046500098F023957E9173957A3308F070E37C93FC :104660002013B8F77E9170617D9330F0839571E3EC :104670007D9370E32A95E1F71124EF90FF900F915D :104680001F91CF91DF91992787FD90950895DC01C7 :10469000FC01672F71917723E1F7329704C07C9179 :1046A0006D9370836291AE17BF07C8F308950E949F :1046B000992308F481E00895E89409C097FB3EF43B :1046C00090958095709561957F4F8F4F9F4F99235F :1046D000A9F0F92F96E9BB279395F69587957795DD :1046E0006795B795F111F8CFFAF4BB0F11F460FF9D :1046F0001BC06F5F7F4F8F4F9F4F16C0882311F0F5 :1047000096E911C0772321F09EE8872F762F05C008 :10471000662371F096E8862F70E060E02AF09A95A3 :10472000660F771F881FDAF7880F9695879597F998 :104730000895990F0008550FAA0BE0E8FEEF161632 :104740001706E807F907C0F012161306E407F50785 :1047500098F0621B730B840B950B39F40A2661F0F9 :10476000232B242B252B21F408950A2609F4A1409C :10477000A6958FEF811D811D08950E94D0230C9472 :1047800041240E94332438F00E943A2420F09523DB :1047900011F00C942A240C94302411240C947524C8 :1047A0000E94522470F3959FC1F3950F50E0551F5E :1047B000629FF001729FBB27F00DB11D639FAA2776 :1047C000F00DB11DAA1F649F6627B00DA11D661FC5 :1047D000829F2227B00DA11D621F739FB00DA11DE6 :1047E000621F839FA00D611D221F749F3327A00DA0 :1047F000611D231F849F600D211D822F762F6A2F3C :1048000011249F5750409AF0F1F088234AF0EE0FA0 :10481000FF1FBB1F661F771F881F91505040A9F7CD :104820009E3F510580F00C942A240C9475245F3F20 :10483000E4F3983ED4F3869577956795B795F79509 :10484000E7959F5FC1F7FE2B880F911D9695879581 :1048500097F9089597F99F6780E870E060E0089500 :104860009FEF80EC089500240A9416161706180688 :104870000906089500240A94121613061406050664 :104880000895092E0394000C11F4882352F0BB0FF5 :1048900040F4BF2B11F460FF04C06F5F7F4F8F4F58 :1048A0009F4F089557FD9058440F551F59F05F3F93 :1048B00071F04795880F97FB991F61F09F3F79F042 :1048C00087950895121613061406551FF2CF4695C4 :1048D000F1DF08C0161617061806991FF1CF869546 :1048E0007105610508940895E894BB27662777272A :1048F000CB0197F908952F923F924F925F926F925A :104900007F928F929F92AF92BF92CF92DF92EF925F :10491000FF920F931F93CF93DF93CDB7DEB7CA1BE0 :10492000DB0B0FB6F894DEBF0FBECDBF09942A880B :10493000398848885F846E847D848C849B84AA84B3 :10494000B984C884DF80EE80FD800C811B81AA8140 :10495000B981CE0FD11D0FB6F894DEBF0FBECDBF0B :10496000ED010895A29FB001B39FC001A39F700DF8 :10497000811D1124911DB29F700D811D1124911D67 :1049800008955058BB27AA270E94D9240C9441248B :104990000E94332438F00E943A2420F039F49F3FDB :1049A00019F426F40C9430240EF4E095E7FB0C94F3 :1049B0002A24E92F0E94522458F3BA17620773077A :1049C0008407950720F079F4A6F50C9474240EF46E :1049D000E0950B2EBA2FA02D0B01B90190010C010F :1049E000CA01A0011124FF27591B99F0593F50F427 :1049F000503E68F11A16F040A22F232F342F44277F :104A0000585FF3CF469537952795A795F040539576 :104A1000C9F77EF41F16BA0B620B730B840BBAF046 :104A20009150A1F0FF0FBB1F661F771F881FC2F7B1 :104A30000EC0BA0F621F731F841F48F487957795C5 :104A40006795B795F7959E3F08F0B0CF9395880F7F :104A500008F09927EE0F9795879508950E944225B3 :104A60000C9441240E943A2458F00E94332440F0D0 :104A700029F45F3F29F00C942A2451110C947524D9 :104A80000C9430240E94522468F39923B1F35523E7 :104A900091F3951B550BBB27AA2762177307840751 :104AA00038F09F5F5F4F220F331F441FAA1FA9F3E7 :104AB00035D00E2E3AF0E0E832D091505040E695D5 :104AC000001CCAF72BD0FE2F29D0660F771F881F36 :104AD000BB1F261737074807AB07B0E809F0BB0B29 :104AE000802DBF01FF2793585F4F3AF09E3F51053D :104AF00078F00C942A240C9475245F3FE4F3983EDC :104B0000D4F3869577956795B795F7959F5FC9F725 :104B1000880F911D9695879597F90895E1E0660FA6 :104B2000771F881FBB1F621773078407BA0720F01F :104B3000621B730B840BBA0BEE1F88F7E095089588 :104B40000E94A7256894B1110C94752408950E94C1 :104B50005A2488F09F5798F0B92F9927B751B0F091 :104B6000E1F0660F771F881F991F1AF0BA95C9F7F1 :104B700014C0B13091F00E947424B1E008950C94F7 :104B80007424672F782F8827B85F39F0B93FCCF3AA :104B9000869577956795B395D9F73EF4909580956E :104BA000709561957F4F8F4F9F4F0895991B79E0C6 :104BB00004C0991F961708F0961B881F7A95C9F7AD :104BC00080950895AA1BBB1B51E107C0AA1FBB1FFC :104BD000A617B70710F0A61BB70B881F991F5A9589 :104BE000A9F780959095BC01CD01089597FB072EFC :104BF00016F4009407D077FD09D00E94E22507FC47 :104C000005D03EF4909581959F4F089570956195DC :104C10007F4F0895A1E21A2EAA1BBB1BFD010DC0F8 :104C2000AA1FBB1FEE1FFF1FA217B307E407F5075C :104C300020F0A21BB30BE40BF50B661F771F881F38 :104C4000991F1A9469F760957095809590959B01CE :104C5000AC01BD01CF010895052E97FB1EF4009411 :104C60000E94432657FD07D00E940A2607FC03D066 :104C70004EF40C94432650954095309521953F4F26 :104C80004F4F5F4F089590958095709561957F4F38 :104C90008F4F9F4F0895EE0FFF1F0590F491E02D69 :104CA00009940E94B224B7FF0895821B930B0895C4 :104CB0000F931F93CF93DF938230910510F482E01E :104CC00090E0E0910706F091080620E030E0A0E0D7 :104CD000B0E0309719F1408151810281138148176A :104CE0005907C8F08417950769F4109731F01296A8 :104CF0000C93129713961C9327C0009307061093EA :104D0000080622C02115310519F04217530718F47F :104D10009A01BD01EF01DF01F801DBCF211531055B :104D2000F9F0281B390B2430310580F48A819B81EE :104D30006115710521F0FB019383828304C0909378 :104D4000080680930706FE01329644C0FE01E20F7A :104D5000F31F8193919322503109398328833AC0FC :104D60002091050630910606232B41F4209129015C :104D700030912A01309306062093050620912701E1 :104D8000309128012115310541F42DB73EB74091EE :104D90002B0150912C01241B350BE0910506F0915D :104DA0000606E217F307A0F42E1B3F0B281739075E :104DB00078F0AC014E5F5F4F2417350748F04E0F77 :104DC0005F1F50930606409305068193919302C09E :104DD000E0E0F0E0CF01DF91CF911F910F910895B6 :104DE000CF93DF93009709F481C0FC0132971382BF :104DF0001282A0910706B0910806109781F42081D5 :104E00003181820F931F20910506309106062817E5 :104E1000390751F5F0930606E093050667C0ED01EA :104E200020E030E0CE17DF0740F44A815B819E012D :104E300041155105F1F0EA01F5CFD383C2834081DA :104E40005181840F951FC817D90759F4888199811A :104E5000840F951F0296918380838A819B8193831F :104E600082832115310529F4F0930806E0930706A3 :104E70003DC0E901FB83EA8349915991C40FD51FD5 :104E8000EC17FD0761F480819181840F951F0296D4 :104E9000E90199838883828193819B838A83E0E0FF :104EA000F0E012968D919C911397009719F0FD01F7 :104EB000DC01F7CF8D919C9111979D012E5F3F4FA3 :104EC000820F931F20910506309106062817390797 :104ED00069F4309729F4109208061092070602C070 :104EE00013821282B0930606A0930506DF91CF913C :104EF0000895A0E0B0E0EFE7F7E20C947F24EC0126 :104F0000009721F4CB010E945826B4C0FC01E60FA3 :104F1000F71F9C0122503109E217F30708F4A8C0DB :104F2000D9010D911C91119706171707B0F00530A4 :104F3000110508F49BC0C80104978617970708F469 :104F400095C002501109061B170B019311936D9325 :104F50007C93CF010E94F02689C05B01A01AB10AA0 :104F60004C01800E911EA0910706B0910806612C9D :104F7000712CE12CF12C109709F446C08D919C9175 :104F80001197A815B905B1F56C0142E0C40ED11C0A :104F9000CA14DB0478F14C018A189B08640142E0D2 :104FA000C40ED11C1296BC9012971396AC91B5E02A :104FB000CB16D10440F0B282A38391828082D901C2 :104FC0006D937C9309C00E5F1F4F800F911FF901F5 :104FD00091838083EB2DFA2FE114F10431F0D70196 :104FE0001396FC93EE93129741C0F0930806E0935A :104FF00007063CC06816790608F43C017D0112964C :105000000D90BC91A02DB7CF80910506909106061A :1050100088169906E1F466167706C8F48091270190 :1050200090912801009741F48DB79EB740912B01D4 :1050300050912C01841B950BE817F907C8F4F093E5 :105040000606E0930506F901718360830FC0CB016A :105050000E9458267C01009759F0A801BE010E94C9 :105060004428CE010E94F026C70104C0CE0102C030 :1050700080E090E0CDB7DEB7EEE00C949B2481E0B9 :1050800090E0F8940C945428FB01DC0102C00190DC :105090000D9241505040D8F70895FB01DC0101907A :0C50A0000D920020E1F70895F894FFCF76 :1050AC000002070507050500040E1F00001F0E0473 :1050BC0000000000001F0E04040E1F000000000082 :1050CC00FF01070001000100000906800001010436 :1050DC000107010901930297029B029F02A302A7F9 :1050EC0002AB02AF020100040007000F000501082B :1050FC00010D0117041704170417041704100010EE :10510C000010001000100000000300020005000059 :10511C00000300050001000400060002000400006A :10512C00000000060A73099D09530ACE09AC09C098 :10513C0009000000000C0BDF0A3B0BB30AD70AC3B3 :10514C000AB40A00000000690D73093B0BA0085358 :10515C006E6F6F7A65204163746976617465640063 :10516C0053657474696E6720416C61726D310061B6 :10517C006C61726D2E486F7572203D20000D0A0017 :10518C00456E64206368616E6765486F7572004197 :10519C006C61726D203200416C61726D2031004F78 :1051AC004E004F4646003A0020414D0020504D0025 :1051BC0020204D00204461696C7900205765656B97 :1051CC0064617900205765656B656E6400204F6ED5 :1051DC0063650020414D200020504D200020204DC3 :1051EC00200043002F00427574746F6E20486F6C62 :1051FC0064202D2000536E6F6F7A655F50696E00CE :10520C004C745F50696E0052745F50696E00427549 :10521C0074746F6E20436C69636B202D2000427593 :10522C0074746F6E20436C69636B2069676E6F7268 :10523C006564002D2D2D0053756E004D6F6E00545E :10524C0075650057656400546875004672690053B3 :10525C00617400536574757020426567696E005007 :10526C006F7765724C6F7373205374617465005261 :10527C00656769737465722030783045203D200075 :10528C0052656769737465722030783046203D2012 :10529C0000536574757020456E6400436C6F636BCE :1052AC005374617465203D20506F7765724C6F7339 :1052BC007300436C6F636B5374617465203D2053B2 :1052CC00686F77436C6F636B00436C6F636B5374E5 :1052DC00617465203D2053686F77416C61726D314C :1052EC0000436C6F636B5374617465203D2053688D :1052FC006F77416C61726D3200436C6F636B5374EA :10530C00617465203D20416C61726D00436C6F636C :10531C006B5374617465203D2045646974436C6FF4 :10532C00636B00436C6F636B5374617465203D2039 :10533C0045646974416C61726D3100436C6F636BD1 :10534C005374617465203D2045646974416C6172CD :10535C006D3200436C6F636B5374617465203D2038 :0C536C0064656661756C742121003000DE :00000001FF ================================================ FILE: Lesson 19 - Real Time Clock Module/RTC_Alarm/RTC_Alarm.ino.with_bootloader.standard.hex ================================================ :100000000C94FE000C9426010C9426010C942601FD :100010000C9426010C9426010C9426010C941709CB :100020000C9426010C9426010C9426010C942601B4 :100030000C9426010C9426010C9426010C942601A4 :100040000C942E1A0C9426010C94050C0C94DF0BC6 :100050000C9426010C9426010C9426010C94260184 :100060000C946F0D0C9426019E06B906E806C7068F :10007000030712072D072D07F507F707F9071D08D6 :10008000FB07FD07FF070E0814081A081D082108C2 :1000900026082B085D1CA21CB21CD61C011D1F1FAC :1000A000551F6C1F00407A10F35A00A0724E1809B9 :1000B0000010A5D4E80000E87648170000E40B54CF :1000C000020000CA9A3B000000E1F505000080969E :1000D0009800000040420F000000A08601000000D0 :1000E000102700000000E80300000000640000008A :1000F00000000A00000000000100000000002C7653 :10010000D888DC674F0823DFC1DFAE59E1B1B7966D :10011000E5E3E453C63AE651997696E8E6C28426CA :10012000EB898C9B62ED407C6FFCEFBC9C9F40F2A6 :10013000BAA56FA5F490055A2AF75C936B6CF96722 :100140006DC11BFCE0E40D47FEF520E6B500D0EDE7 :10015000902E0300943577050080841E080000204F :100160004E0A000000C80C333333330F986E1283ED :100170001141EF8D2114893BE65516CFFEE6DB18C1 :10018000D1844B381BF77C1D901DA4BBE424203286 :1001900084725E228100C9F124ECA1E53D270200B2 :1001A000000000240027002A00000000002500288D :1001B000002B000000000023002600290004040496 :1001C0000404040404020202020202030303030300 :1001D00003010204081020408001020408102001DD :1001E00002040810200000000800020100000304BF :1001F000070000000000000000005B2011241FBE6B :10020000CFEFD8E0DEBFCDBF26E0ACECB3E001C05D :100210001D92A930B207E1F713E0A0E0B1E0ECEAEB :10022000F0E502C005900D92AC3CB107D9F710E0A3 :10023000CEEFD0E004C02197FE010E944B26CD3FB7 :10024000D107C9F70E94781A0C9454280C94000026 :100250000F931F93CF93DF9300D000D000D0CDB782 :10026000DEB7082F162F0E949211842F462F298364 :100270003A838B835C836D837E83123080F48D3070 :1002800018F091E09D8301C01D822CE0622F0E9436 :10029000D625992311F09B830DC02B830BC0123000 :1002A00049F42CE0622F0E94D625429F900D112424 :1002B0009B831D83602FCE0101960E946C142696AD :1002C0000FB6F894DEBF0FBECDBFDF91CF911F9167 :1002D0000F9108950F931F93CF93DF9300D000D019 :1002E00000D0CDB7DEB7182F062F813009F012E00D :1002F000812F0E94921129833A834B836D837E83E1 :10030000852F90E0002321F001968370992709C082 :10031000019764E070E00E94F62597FF02C083E039 :1003200090E08C83612FCE0101960E946C1426967A :100330000FB6F894DEBF0FBECDBFDF91CF911F91F6 :100340000F9108951F93CF93DF9300D000D000D07A :10035000CDB7DEB7BE016F5F7F4F8FE00E94CB1637 :10036000198110FF22C08091DA05882361F081E0B5 :100370000E942F1129833A834B835C836D837E8394 :100380001092DA0509C081E00E94921129833A8314 :100390004B835C836D837E838C81833009F41E8262 :1003A00061E0CE0101960E946C1411FF22C0809181 :1003B000DB05882361F082E00E942F1129833A83B4 :1003C0004B835C836D837E831092DB0509C082E0E2 :1003D0000E94921129833A834B835C836D837E83D1 :1003E0008C81833009F41E8262E0CE0101960E9466 :1003F0006C14612F6C7F8FE00E947E138DE00E9451 :10040000541960E08DE00E947D190E947A152696AD :100410000FB6F894DEBF0FBECDBFDF91CF911F9115 :1004200008958FEA91E00E9485148091EB03823059 :1004300041F0833019F0813039F404C081E00E942A :100440001A1882E00E941A188DE00E94541960E088 :100450008DE00E947D190C947A150F931F93CF9312 :10046000DF93CDB7DEB72E970FB6F894DEBF0FBE81 :10047000CDBF182F062F0E94F01129833A834B839A :100480005C836D837E838F839887892F90E011230F :1004900019F01330A8F51FC0002331F0019663E076 :1004A00070E00E94F62509C0019763E070E00E94A9 :1004B000F62597FF02C082E090E08887CE01019682 :1004C0000E949814688581E00E942801688582E076 :1004D0000E94280115C0029799F0812F0E94921165 :1004E00029873A874B875C877E87611103C081E04B :1004F0008D8701C01D86612FCE0109960E946C1464 :100500002E960FB6F894DEBF0FBECDBFDF91CF9110 :100510001F910F9108950F931F93CF93DF93CDB742 :10052000DEB72E970FB6F894DEBF0FBECDBF182FE3 :10053000062F813029F070F0823061F482E001C032 :1005400081E00E94921129873A874B875C876D87EB :100550007E870AC00E94F01129833A834B835C8313 :100560006D837E838F839887832F90E0002331F003 :1005700001966CE370E00E94F62509C001976CE3D8 :1005800070E00E94F62597FF02C08BE390E01130E7 :1005900031F060F0123051F48A8762E002C08A873D :1005A00061E0CE0109960E946C1405C08A83CE01D9 :1005B00001960E9498142E960FB6F894DEBF0FBED7 :1005C000CDBFDF91CF911F910F910895EF92FF92D0 :1005D0000F931F93CF93DF93CDB7DEB72E970FB650 :1005E000F894DEBF0FBECDBFF82EE62E81E0F816E0 :1005F000C1F0F81620F082E0F81619F132C00E941E :10060000F01129833A834B835C836D837E838F83D0 :100610009887042F10E09230A8F1923009F443C07B :1006200082C081E00E94921129873A874B875C87BC :100630006D877E87042F10E0623020F1623099F1DF :100640004FC082E00E94921129873A874B875C87CE :100650006D877E87042F10E06230A0F0623019F1C0 :100660005BC00E94F01129833A834B835C836D83C6 :100670007E838F839887042F10E0923018F0923099 :1006800091F025C0C801EE2011F0019601C001973C :100690006CE070E00E94F6258C0118161906BCF07B :1006A0000CE010E014C0C801EE2039F0019668E1BA :1006B00070E00E94F6258C010AC0019768E170E0A5 :1006C0000E94F6258C0197FF02C007E110E081E04F :1006D000F81631F0F81638F182E0F81224C01CC088 :1006E00080EC91E00E9485140B876FEC71E085EB44 :1006F00094E00E94DD0B4B8550E060E070E02AE062 :1007000085EB94E00E94940B6DED71E085EB94E035 :100710000E947F0B61E002C00B8762E0CE01099668 :100720000E946C1405C00B83CE0101960E949814A0 :1007300080EE91E00E9485142E960FB6F894DEBFED :100740000FBECDBFDF91CF911F910F91FF90EF9022 :1007500008950F931F93CF93DF93CDB7DEB72897FC :100760000FB6F894DEBF0FBECDBF98E0EDE2F1E02A :10077000DE01119601900D929A95E1F7FE013196F6 :10078000E80FF11DE80FF11D618180810E9484183E :1007900003EE15E0F8018089982F9260908B8A60B3 :1007A0000E946C15F8018089982F9160908B896068 :1007B00028960FB6F894DEBF0FBECDBFDF91CF9164 :1007C0001F910F910C946C15CF92DF92EF92FF92D4 :1007D0000F931F93CF93DF93CDB7DEB72C970FB650 :1007E000F894DEBF0FBECDBFC82ED62E82E0C81251 :1007F00081E00E9492112F837C87062F152FF42E03 :10080000E32E8091D6038F1511F0DD24D3948091CF :10081000D503E81611F0DD24D3948091D803801716 :1008200011F0DD24D3948091D703181303C0DD2089 :1008300009F47AC00E94721560E080E00E9484187A :1008400082E0C81203C06FEE71E002C067EF71E092 :1008500083EE95E00E94DD0B60E08DE00E9484183D :100860008C85882319F06FEF71E002C062E072E0BE :1008700083EE95E00E94DD0B61E080E00E94841829 :100880006F2D70E0CE0101960E94450FCE010196BA :100890000E94CE18CE0101960E94FD0866E072E02B :1008A00083EE95E00E94DD0B6E2D70E0CE01019687 :1008B0000E94450FCE0101960E94CE18CE010196EE :1008C0000E94FD08013021F030F468E072E005C0BC :1008D0006CE072E002C060E172E083EE95E00E949D :1008E000DD0B113059F038F0123059F0133079F433 :1008F0006DE272E008C064E172E005C06BE172E095 :1009000002C064E272E083EE95E00E94DD0BE886AF :10091000F9861A870B8786E0FE013796A4EDB3E0CF :1009200001900D928A95E1F72C960FB6F894DEBFF0 :100930000FBECDBFDF91CF911F910F91FF90EF9030 :10094000DF90CF9008954F925F926F927F92BF9207 :10095000CF92DF92EF92FF920F931F93CF93DF938B :10096000CDB7DEB7AF970FB6F894DEBF0FBECDBFE1 :10097000182F0E94F011C32EB42EE62ED72EF82E7B :10098000092F2AA33BA34CA35DA36EA37FA388A733 :1009900099A70E94221A4090E7035090E8036090C4 :1009A000E9037090EA03DC01CB0184199509A609DB :1009B000B709883E9D4FA105B10530F490912601FD :1009C00080915E05981771F14090E3035090E40325 :1009D0006090E5037090E6030E94EF0E6093E303DE :1009E0007093E4038093E5039093E6030E94221A38 :1009F0006093E7037093E8038093E9039093EA031D :100A00008091260180935E052091E3033091E403F9 :100A10004091E5035091E603C301B2010E945723C0 :100A2000811111E08091CE038B1111E08091CD03F3 :100A3000C81211E08091D303801311E08091D0039C :100A4000E81211E08091D103D81211E08091D20315 :100A5000F81203C0112309F41FC10E94721560E04F :100A600080E00E9484186B2D70E0CE0101960E94F8 :100A7000450FCE0101960E94CE18CE0101960E942C :100A8000FD0866E072E083EE95E00E94DD0B6C2DC0 :100A900070E0CE0101960E94450FCE0101960E94A2 :100AA000CE18CE0101960E94FD08013049F028F0D1 :100AB000023061F46DE372E005C063E372E002C0EE :100AC00068E372E083EE95E00E94DD0B20E030E009 :100AD00048EC52E46091E3037091E4038091E503F4 :100AE0009091E6030E94572387FF06C063E572E0FA :100AF00083EE95E00E94DD0B6091E3037091E403C7 :100B00008091E5039091E6031BA61AA61DA61CA6DC :100B10001FA61EA68E010F5F1F4F21E043E00E941B :100B2000D020009771F0FC0101900020E9F7319787 :100B3000AF01481B590BBC01CE018A960E94DC080C :100B400004C0CE018A960E94CA08CE018A960E94ED :100B5000CE18CE018A960E94FD0841E06FED83EE2B :100B600095E00E94160D80912601882319F064E01B :100B700072E002C062E472E083EE95E00E94DD0B59 :100B800061E080E00E948418EDA1E83008F0E0E028 :100B9000F0E0EE0FFF1FEB5CFE4F60817181CE0134 :100BA00001960E940209CE0101960E94CE18CE0144 :100BB00001960E94FD0863E572E083EE95E00E94D5 :100BC000DD0B6D2D70E0CE0101960E94450FCE0128 :100BD00001960E94CE18CE0101960E94FD0864E4A1 :100BE00072E083EE95E00E94DD0B6E2D70E0CE0189 :100BF00001960E94450FCE0101960E94CE18CE01AB :100C000001960E94FD0864E472E083EE95E00E9484 :100C1000DD0B4F2D50E04053584F052E000C660B56 :100C2000770B2AE083EE95E00E94940B64E083EE5C :100C300095E00E94690D1982BE016F5F7F4F8EE0C3 :100C40000E94CB1689818370823069F0833069F00D :100C5000813039F065E972E083EE95E00E94DD0BAA :100C600009C061E003C062E001C063E083EE95E08B :100C70000E94690D0E94F0112093CC033093CD03A4 :100C80004093CE035093CF036093D0037093D1036E :100C90008093D2039093D303AF960FB6F894DEBF40 :100CA0000FBECDBFDF91CF911F910F91FF90EF90BD :100CB000DF90CF90BF907F906F905F904F9008959E :100CC0000F931F93CF93DF93EC0166E472E085EB03 :100CD00094E00E94DD0B8C818A3051F08B3029F03A :100CE000893051F480E692E005C085E592E002C0CB :100CF00087E692E00E9485140E94221A0091DB038D :100D00001091DC032091DD033091DE03DC01CB0187 :100D1000801B910BA20BB30B813D9740A105B10540 :100D200008F4BBC0E0912401F0912501E830F10501 :100D300008F0B3C0EC5CFF4F0C944B2685E090E0CC :100D400090932501809324011092EC030E94221AB3 :100D50006093DB037093DC038093DD039093DE03E9 :100D600081E08093DA03DF91CF911F910F910C9472 :100D7000D7188C818A3079F08B3059F585E090E076 :100D800090932501809324011092EC0358C08C812C :100D90008A3009F082C087E090E09093250180932B :100DA00024011092EC030E94221A6093DB037093DB :100DB000DC038093DD039093DE0381E08093DA030C :100DC00061E082E0DF91CF911F910F910C94E403D9 :100DD0008C81893009F061C086E090E09093250114 :100DE000809324011092EC030E94221A6093DB038B :100DF0007093DC038093DD039093DE0381E08093A6 :100E0000DA0361E0DFCF8C81893008F446C08B3093 :100E100030F08B3009F041C00E94110225C00E94C1 :100E2000A20122C08C818B30C1F50E94EC180E9477 :100E3000F41881E090E090932501809324010E94B2 :100E4000221A6093DB037093DC038093DD0390939D :100E5000DE0381E08093DA0320C08C818B30E9F4DB :100E60000E94EC180E94F41881E090E09093250114 :100E7000809324010E94221A6093DB037093DC03A9 :100E80008093DD039093DE0381E08093DA03DF91AA :100E9000CF911F910F910C94A304DF91CF911F91DB :100EA0000F9108959091260181E089278093260172 :100EB0000E94EF0E6093E3037093E4038093E503D5 :100EC0009093E6030E94221A6093E7037093E8036D :100ED0008093E9039093EA0381E00C94A304CF93F9 :100EE000DF93EC016EE672E085EB94E00E94DD0B8F :100EF0008C818A3051F08B3029F0893051F480E6B2 :100F000092E005C085E592E002C087E692E00E948B :100F100085148091DA03882339F08EE792E00E94ED :100F200085141092DA0309C1809124019091250162 :100F30008430910531F128F4009761F00197A1F018 :100F4000FCC08630910509F48BC080F1079709F445 :100F5000B8C0F3C081E090E0909325018093240114 :100F6000DF91CF910C94D7188C81893029F08A3089 :100F700009F0E3C082E001C081E0DF91CF910C94E1 :100F8000B30E8C81893008F4D8C08B3030F08B30B0 :100F900009F0D3C00E94110202C00E94A20181E0A8 :100FA00090E09093250180932401C7C08C818A3002 :100FB00041F18B3021F0893009F0BFC009C0809128 :100FC000EC038F5F67E00E94D6259093EC03B5C0D9 :100FD000E091EC038E2F90E08730910508F0ADC0D2 :100FE000FC01E45CFF4F0C944B2660E018C060E00D :100FF0001CC060E020C080E025C080E028C080E008 :101000002BC0E091EC038E2F90E08730910508F023 :1010100094C0FC01ED5BFF4F0C944B2661E080E037 :10102000DF91CF910C94E60261E080E0DF91CF91F7 :101030000C948B0261E080E077C0DF91CF910C943B :10104000520781E0DF91CF910C94531781E0DF913B :10105000CF910C948C1781E0DF91CF910C94E51720 :101060008C818A30B9F08B30A1F1893009F065C0EC :101070008091EC03813051F038F0823049F08330B8 :1010800009F05BC060E01BC060E011C060E012C00E :1010900060E013C08091EC03813059F038F0823069 :1010A00059F0833009F049C061E009C061E081E096 :1010B000B7CF61E081E0BACF61E081E035C081E087 :1010C00038C08C818A30E9F08B3019F08930A9F56D :1010D00007C08091EC038F5F83708093EC032DC079 :1010E0008091EC03813049F030F0823041F0833060 :1010F00021F560E01DC060E010C060E011C060E05C :1011000012C08091EC03813051F030F0823051F008 :10111000833099F461E00CC061E082E081CF61E04E :1011200082E084CF61E082E0DF91CF910C942D02C8 :1011300082E0DF91CF910C946A01DF91CF91089505 :1011400008950E943F280F931F93CF93DF93EC01E4 :1011500088819981009729F02A813B8126173707DA :1011600088F48B016F5F7F4F0E947927009761F0B1 :10117000998388831B830A832C813D81232B11F45F :10118000FC01108281E001C080E0DF91CF911F91CE :101190000F910895CF93DF93EC0188819981009797 :1011A00011F00E94F026198218821D821C821B8277 :1011B0001A82DF91CF910895EF92FF920F931F93C0 :1011C000CF93DF93EC017B018A01BA010E94A3084F :1011D000811104C0CE010E94CA0807C01D830C8380 :1011E000B701888199810E944D28CE01DF91CF916E :1011F0001F910F91FF90EF900895FC0180819181E4 :101200000C94F026FC011182108213821282158246 :1012100014826115710551F0FB0101900020E9F77E :101220003197AF01461B570B0C94DC0808951F92B1 :101230000F920FB60F9211242F933F934F935F930A :101240006F937F938F939F93AF93BF93EF93FF938E :101250008091F6039091F703A091F803B091F90300 :10126000892B8A2B8B2B51F19091F103E091F203A2 :10127000F091F3038081892780838091F603909118 :10128000F703A091F803B091F903181619061A068E :101290001B06C4F48091F6039091F703A091F80324 :1012A000B091F9030197A109B1098093F6039093D6 :1012B000F703A093F803B093F90304C080912001D1 :1012C0000E94540BFF91EF91BF91AF919F918F912D :1012D0007F916F915F914F913F912F910F900FBE32 :1012E0000F901F901895CF92DF92EF92FF920F937D :1012F0001F93CF93DF936C017A018B01C0E0D0E0A4 :10130000CE15DF0581F0D8016D918D01D601ED91EB :10131000FC910190F081E02DC6010995892B11F017 :101320002196EECF7E01C701DF91CF911F910F91E2 :10133000FF90EF90DF90CF900895FC01538D448D86 :10134000252F30E0842F90E0821B930B541710F070 :10135000CF96089501970895FC01918D828D98177D :1013600061F0828DDF01A80FB11D5D968C91928D89 :101370009F5F9F73928F90E008958FEF9FEF089586 :10138000FC01918D828D981731F0828DE80FF11D4F :10139000858D90E008958FEF9FEF0895FC01918D6A :1013A000228D892F90E0805C9F4F821B91098F7363 :1013B0009927089585EB94E00E94CE0921E0892BBE :1013C00009F420E0822F0895FC01848DDF01A80F2D :1013D000B11DA35ABF4F2C91848D90E001968F735D :1013E0009927848FA689B7892C93A089B1898C917C :1013F000837080648C93938D848D981306C00288CB :10140000F389E02D80818F7D80830895EF92FF9294 :101410000F931F93CF93DF93EC0181E0888F9B8D17 :101420008C8D981305C0E889F989808185FD26C0D7 :10143000F62E0B8D10E00F5F1F4F0F731127E02E5C :101440008C8DE8120CC00FB607FCFACFE889F98939 :10145000808185FFF5CFCE010E94E409F1CF8B8D0D :10146000FE01E80FF11DE35AFF4FF0829FB7F89499 :101470000B8FEA89FB89808180620AC09FB7F8944C :10148000EE89FF896083E889F989808183708064AF :1014900080839FBF81E090E0DF91CF911F910F91FA :1014A000FF90EF900895CF93DF93EC01888D882310 :1014B000C9F0EA89FB89808185FD05C0A889B989C1 :1014C0008C9186FD0FC00FB607FCF5CF808185FF9C :1014D000F2CFA889B9898C9185FFEDCFCE010E940A :1014E000E409E7CFDF91CF91089580E090E0892B68 :1014F00029F00E94DA0981110C940000089585ED0D :101500008093BC008091BC0084FDFCCF1092B40499 :10151000089540912604262F30E0240F311D2132FA :101520003105DCF42091B4042430C9F4FC0180E0DE :1015300090E0861758F4309126042191DC01AA5FCF :10154000BB4FA30FB11D2C930196F3CF80912604BE :10155000680F6093260480E0089581E0089582E09A :101560000895089508950895E0914A0480914904EA :10157000E81730F4F0E0E259FB4F808190E00895E5 :101580008FEF9FEF089590914A0480914904981736 :1015900050F4E92FF0E0E259FB4F208130E09F5FEB :1015A00090934A0402C02FEF3FEFC9010895809144 :1015B000490490E020914A04821B91090895CF923A :1015C000DF92EF92FF920F931F93CF93DF937C01F3 :1015D000CB018A0120914B04222389F0EB016B019E :1015E000C40ED51ECC15DD0569F06991D701ED91CA :1015F000FC910190F081E02DC7010995F3CF642F94 :101600000E94890AC801DF91CF911F910F91FF902D :10161000EF90DF90CF900895CF93DF931F92CDB7D7 :10162000DEB7698320914B042223D1F020916D0411 :10163000203240F021E030E0FC013383228380E05F :1016400090E015C080914C04E82FF0E0E35BFB4F85 :10165000998190838F5F80934C0480936D0405C0C3 :1016600061E0CE0101960E94890A81E090E00F902E :10167000DF91CF91089580E090E00895CF93DF93BC :10168000EC0160E08E810E947D1961E08E810E94F4 :101690007D1960E08E810E947D198BE891E00197B1 :1016A000F1F7DF91CF91089590912001891324C023 :1016B000EEE9F1E0E4919FEF90932001E130B9F081 :1016C00098F0E230C9F4909170009D7F9093700083 :1016D00091E09093B0009091B100987F94609093C6 :1016E000B1001092B30008C010926E0005C0909136 :1016F0006F009D7F90936F0060E00C947D196115E1 :10170000710579F0FB0101900020E9F73197AF01F5 :10171000461B570BDC01ED91FC910280F381E02D1B :10172000099480E090E008958F929F92AF92BF92CB :10173000EF92FF920F931F93CF93DF93CDB7DEB756 :10174000A1970FB6F894DEBF0FBECDBF7C01FA01A2 :10175000CB0119A2223008F42AE08E010F5D1F4F41 :10176000822E912CA12CB12CBF01A50194010E94C5 :101770000A26F901CA01015011096A3014F4605DAA :1017800001C0695CD8016C93232B242B252B61F7B6 :10179000B801C7010E947F0BA1960FB6F894DEBF77 :1017A0000FBECDBFDF91CF911F910F91FF90EF90B2 :1017B000BF90AF909F908F9008950C947F0B1F92D5 :1017C0000F920FB60F9211242F933F934F935F9375 :1017D0006F937F938F939F93AF93BF93EF93FF93F9 :1017E00085EB94E00E94E409FF91EF91BF91AF91E6 :1017F0009F918F917F916F915F914F913F912F9129 :101800000F900FBE0F901F9018951F920F920FB65A :101810000F9211242F938F939F93EF93FF93E09157 :10182000C504F091C6048081E091CB04F091CC0412 :1018300082FD12C090818091CE048F5F8F732091C2 :10184000CF04821751F0E091CE04F0E0EB54FB4F4F :10185000958F8093CE0401C08081FF91EF919F917D :101860008F912F910F900FBE0F901F9018950F938F :101870001F93CF93DF93EC018E8180FF02C08260C3 :1018800001C08D7F8E838C810E9454194D8150E060 :101890002E818417950711F42E7F01C021602E83BD :1018A0008E81282F30E0A9015595479524273527AB :1018B00020FF5FC00E94221A2F81222351F02D8920 :1018C0003E89621B730B898D9A8D6817790708F41E :1018D0007BC00E94221A6D8B7E8B8F8B988F8E819E :1018E00080FF13C08DA19EA101969EA38DA3EB8DB9 :1018F000FC8D309711F0CE0109950E94221A69875C :101900007A878B879C871FA230C0ED8DFE8D309724 :1019100011F0CE010995EF8DF8A1309711F0CE01AD :1019200009950E94221A2D853E85621B730B8A81C0 :101930009B818617970748F081E08887E9A1FAA183 :10194000309721F0CE01099501C0188689859A85C6 :10195000AB85BC858D879E87AF87B88B8FEF9FEF58 :10196000DC0189879A87AB87BC878E8184608E83F0 :101970002BC08B7F8E8389859A85AB85BC858F3FF5 :101980009F4FAF4FBF4F01F18FA181111DC00E942A :10199000221A09851A852B853C85AB01BC01401BA9 :1019A000510B620B730B88819981A0E0B0E0841722 :1019B0009507A607B70740F4EBA1FCA1309721F0EB :1019C000CE01099581E08FA3DF91CF911F910F91F7 :1019D0000895CF92DF92EF92FF920F931F93CF93D0 :1019E000DF936C017C0187E0E80EF11CC0E0D0E0E1 :1019F000062F10E0B8010C2E02C0759567950A9469 :101A0000E2F76170F70181917F010E947D192196B3 :101A1000C430D10579F7C601DF91CF911F910F91A5 :101A2000FF90EF90DF90CF900C943E0BCF92DF921F :101A3000EF92FF920F931F93CF93DF93EC01F62E5B :101A4000642F8C810E947D198D818F3F19F060E099 :101A50000E947D198F850F2D10E084FF25C06E0137 :101A600087E0C80ED11CE12CF12CB8010E2C02C06D :101A7000759567950A94E2F76170F60181916F019F :101A80000E947D19FFEFEF1AFF0A88E0E816F104C3 :101A900061F7CE01DF91CF911F910F91FF90EF90F1 :101AA000DF90CF900C943E0BB80184E0759567955C :101AB0008A95E1F7CE010E94E90C6F2DCE01DF91EE :101AC000CF911F910F91FF90EF90DF90CF900C94EA :101AD000E90C41E00E94160D81E090E008951F920C :101AE0000F920FB60F9211242F933F934F935F9352 :101AF0006F937F938F939F93AF93BF93EF93FF93D6 :101B00008091B900887F803609F49CC068F58832DE :101B100009F45BC090F4803109F454C038F4882390 :101B200009F4F6C0883009F44DC0F6C0883109F4D4 :101B30004CC0803209F45DC0EFC0803409F468C045 :101B400048F4803309F455C0883309F0E5C0809328 :101B5000B204D8C0803509F44FC0883509F45DC09F :101B6000883409F0D9C0D6C0883909F4C7C0A8F4B0 :101B7000883709F467C038F4883609F463C08037C1 :101B800009F460C0C9C0883809F4B8C0803909F4C4 :101B90005FC0803809F0C0C05BC0803B09F486C0DC :101BA00038F4803A09F466C0883A09F47FC0B4C0BA :101BB000803C09F4A7C0883C09F4A4C0883B09F420 :101BC0008AC0AAC08091AF0410C09091B1048091E6 :101BD000B004981770F5E091B10481E08E0F809306 :101BE000B104F0E0E257FB4F80818093BB0085ECAD :101BF00086C08093B2048EC0E091B10481E08E0F64 :101C00008093B1048091BB00F0E0E257FB4F8083EA :101C10009091B1048091B0046EC0E091B10481E074 :101C20008E0F8093B1048091BB00F0E0E257FB4F30 :101C300080838091B30481116DC081E08093AE04F4 :101C400084EA61C083E08093B40410924804CFCF4B :101C500080914804803208F051C0E091480481E04E :101C60008E0F809348048091BB00F0E0E85DFB4F4D :101C70008083BDCF85EC8093BC001092B40480912A :101C80004804803230F4E0914804F0E0E85DFB4F16 :101C900010826091480470E0E091DF03F091E0036E :101CA00088E294E009951092480436C084E080935D :101CB000B4041092270410922604E091E103F091FD :101CC000E203099580912604811105C081E080938B :101CD000260410920604E091270481E08E0F809381 :101CE0002704F0E0EA5FFB4F80818093BB00909176 :101CF000270480912604981708F479CF85E880930B :101D0000BC000AC085EC8093BC001092B40404C0EF :101D10001092B2040E947F0AFF91EF91BF91AF91A0 :101D20009F918F917F916F915F914F913F912F91F3 :101D30000F900FBE0F901F9018956AE00E94D62555 :101D4000292F30E1839FC0011124822B0895982F01 :101D50009695969596959E71292F220F220F920F98 :101D60008F70890F08951F93CF93DF9300D000D019 :101D700000D0CDB7DEB7182F823019F483E090E0A1 :101D800002C082E090E09093250180932401812F8E :101D90000E94921129833A834B835C836D8381E097 :101DA00078277E83612FCE0101960E946C140E94D9 :101DB000221A6093ED037093EE038093EF039093E8 :101DC000F00361E0812F0E94E40326960FB6F89499 :101DD000DEBF0FBECDBFDF91CF911F910895CF928F :101DE000DF92EF92FF92CF93DF9300D0CDB7DEB7B3 :101DF0001982BE016E5F7F4F81E10E94CB16BE014A :101E00006F5F7F4F82E10E94CB16698170E086E0B0 :101E1000759567958A95E1F7072E000C880B990B4D :101E20000E945E2320E030E040E85EE30E94BD2394 :101E30006B017C016A8170E080E090E00E945E238B :101E40009B01AC01C701B6010E94C224209126016A :101E5000222391F020E030E040E151E40E94BD23D4 :101E600020E030E040EA50E40E942E2520E030E0FF :101E700040E052E40E94C2240F900F90DF91CF9176 :101E8000FF90EF90DF90CF900895AF92BF92CF92E6 :101E9000DF92EF92FF920F931F93CF93DF93CDB713 :101EA000DEB72C970FB6F894DEBF0FBECDBF8C0106 :101EB0006B016FED71E00E940209CE0101967C0179 :101EC000B6019AE0C916D1040CF040C0CE010796C5 :101ED0000E9496186AEC73E0C7010E9402098B8584 :101EE0009C85AF80B884A114B10409F478C0009730 :101EF000B1F0CD80DE80C80ED91EB601C7010E94A8 :101F0000A308882309F46BC029813A818D819E81C1 :101F1000B501820F931F0E944D28DE82CD82E0160C :101F2000F10671F069817A816115710531F04D8199 :101F30005E81C8010E94DC0803C0C8010E94CA0873 :101F4000C7010E94FD08CE01079635C0C7010E9457 :101F50009618E016F10671F1F801808191810097E1 :101F6000B1F069817A816115710579F042815381FF :101F70002D813E814217530740F00E944D288D81EC :101F80009E81F8019583848313C00E94F026898185 :101F90009A81F801918380838B819C8193838283D2 :101FA0008D819E81958384831A8219821C821B8273 :101FB0001E821D82C7010E94FD08C8012C960FB623 :101FC000F894DEBF0FBECDBFDF91CF911F910F916F :101FD000FF90EF90DF90CF90BF90AF900895C70132 :101FE0000E94CA089CCFCF93C82F8091D8050E9429 :101FF000C1160E94FD16882311F080E030C0809148 :10200000D8050E94C11680E090E00E9400178C2F36 :1020100090E00E9400170E94FD168111EECF41E072 :1020200061E08091D8050E94231610924A048093A3 :10203000490440E050E080E02091490430E0909174 :102040004A04291B3109121613064CF4452B39F4A6 :1020500082E595E00E94C30A41E050E0EDCFCF91C8 :102060000895EF92FF920F931F93CF93DF93D82F92 :102070007B01C42F8091D7050E94C1166D2F82E588 :1020800095E00E940C0B80E00E946516D82F81110C :102090001CC06C2FC13208F060E241E08091D7058E :1020A0000E94231610924A0480934904C8130FC05B :1020B0008701F12CCF1561F082E595E00E94C30AFB :1020C000F80181938F01F394F5CFC0E001C0C82FD0 :1020D000F0E1DF9FC00111248C2BDF91CF911F9184 :1020E0000F91FF90EF900895FF920F931F93CF935E :1020F000DF93C82FF62E072F142F8091D7050E944B :10210000C1166C2F82E595E00E940C0BCF2DD02FCD :10211000CE01810F911D8C01C017D10731F069915B :1021200082E595E00E940C0BF7CF81E0DF91CF9123 :102130001F910F91FF900C946516CF93DF93D82FCA :10214000C62F8091D8050E94C1160E94FD168111EC :102150001BC08091D8050E94C11680E090E00E94CB :1021600000178D2F90E00E9400176C2F82E595E0FC :102170000E940C0B0E94FD166AE070E080E090E087 :10218000DF91CF910C94E819DF91CF910895CF9210 :10219000DF92EF92FF920F931F93CF93DF93CDB710 :1021A000DEB72B970FB6F894DEBF0FBECDBF182F4A :1021B000813011F08AE001C087E044E0BE01695F30 :1021C0007F4F0E943110123009F41F828F818F7768 :1021D0000E94A70EC82E88858F770E94A70ED82E42 :1021E000898586FF08C085FB002700F98F710E9452 :1021F000A70EF82E05C08F730E94A70EF82E02E0DE :1022000088E00E94F30F113029F090E095958795B2 :102210009595879583708B87EB84BE01655F7F4FB3 :102220008EE00E94CB167B85113011F4717002C0D4 :102230007695717096014F2D5E2D602F80E090E0B5 :102240002B960FB6F894DEBF0FBECDBFDF91CF91B6 :102250001F910F91FF90EF90DF90CF900895CF9254 :10226000DF92EF92FF920F931F93CF93DF9300D0F3 :1022700000D000D0CDB7DEB7082F813041F480E028 :102280000E94F30F0E94A70ED82E81E002C0D12C2D :1022900084E00E94F30F0E94A70EC82E013011F0B7 :1022A00085E001C082E00E94F30F86FF08C085FB35 :1022B000FF24F0F88F710E94A70EE82E06C08F73DE :1022C0000E94A70EE82E32E0F32E88E00E94F30F62 :1022D000013029F090E09595879595958795182F71 :1022E000137087E00E94F30F013019F4782F71709A :1022F00003C081FB772770F92D2D3C2D4E2D512FDA :102300006F2D80E090E026960FB6F894DEBF0FBEEA :10231000CDBFDF91CF911F910F91FF90EF90DF9094 :10232000CF900895CF93DF93CDB7DEB762970FB606 :10233000F894DEBF0FBECDBF813019F0823029F195 :1023400035C08091DA05882321F081E00E942F11A9 :1023500003C081E00E94C7102F83388749875A87BE :102360006B877C8786E0FE013796DE01119601902F :102370000D928A95E1F786E0FE013196DE011D9609 :1023800001900D928A95E1F711C08091DB058823B9 :1023900021F082E00E942F1103C082E00E94C7104A :1023A0002D873E874F87588B698B7A8B86E0FE019D :1023B0003D96DE01179601900D928A95E1F72F81E7 :1023C000388549855A856B857C8580E090E06296EA :1023D0000FB6F894DEBF0FBECDBFDF91CF91089549 :1023E000AF92BF92CF92DF92EF92FF920F931F9323 :1023F000CF93DF93CDB7DEB72F970FB6F894DEBF3C :102400000FBECDBF47E0BE01675F7F4F80E00E94F7 :10241000311089850E94A70EA82E8A850E94A70EDA :10242000B82E8B8586FF08C085FB112710F98F71A8 :102430000E94A70EF82E05C08F730E94A70EF82EDB :1024400012E08C850E94A70EC82E8D850E94A70ED3 :10245000D82E8E8587FD02C000E001C004E68F7192 :102460000E94A70EE82E8F850E94A70E95014F2D82 :102470005C2D6D2D7E2D800F912F2F960FB6F89429 :10248000DEBF0FBECDBFDF91CF911F910F91FF90A7 :10249000EF90DF90CF90BF90AF900895EF92FF92B2 :1024A0000F931F93CF93DF93CDB7DEB728970FB667 :1024B000F894DEBF0FBECDBF182FE62EF42E022FEC :1024C0000E94F011242F852F60E177E2969FA001F2 :1024D000979F500D112494E6299F400D511D112402 :1024E000430F511DE69E9001E79E300D112494E6A6 :1024F000F99E200D311D1124200F311D4217530765 :1025000074F4113021F008F11230F9F405C09EEF97 :10251000980F953078F419C08130B1F416C011309D :1025200031F068F0123041F0133049F00EC08F5F87 :10253000873058F082E009C0873030F003C08F5FE9 :10254000883019F481E001C087E028960FB6F8942E :10255000DEBF0FBECDBFDF91CF911F910F91FF90D6 :10256000EF9008958F929F92AF92BF92CF92DF9299 :10257000EF92FF920F931F93CF93DF9300D01F92A0 :10258000CDB7DEB78C01A62E21E0621309C0FC0195 :1025900080810E949D0E8983682F80E00E949D109B :1025A000F801E1808E2D0E949D0E8983F801F48050 :1025B000F2E0FF1206C0F80182810E949D0E8F7327 :1025C0000DC0F8018281F11005C00E949D0E8F712F :1025D000806404C00E949D0E8F7180668A832E2DB8 :1025E000F80142816F2D83810E944E120E949D0E40 :1025F000F8019381911102C0806801C080648B83CF :10260000F1E0AF1619F094E0B92E02C0BB24B394E8 :10261000812C912C83E0C82ED12C6091E205E62E0E :10262000F12C8B2D0E94D625E91AF108C6012FE165 :10263000C216D10414F08EE190E08E159F050CF4C3 :102640007C018091D8050E94C1160E94FD1681115F :1026500020C08091D8050E94C11680E090E00E94C1 :1026600000178B2D90E00E94001743E050E061E0DE :1026700070E06C0F7D1F680D791D82E595E00E946A :10268000DF0A0E94FD166AE070E080E090E00E94A0 :10269000E819CE18DF088E0C9F1CBE0C1C141D04FC :1026A0000CF4BBCF87E00E94F30F982F9770F801CE :1026B0002581F1E0AF1206C0222311F0916005C020 :1026C000867006C0222319F09260998302C085703B :1026D0008983698187E00E949D1081E00F900F90AF :1026E0000F90DF91CF911F910F91FF90EF90DF90AE :1026F000CF90BF90AF909F908F900895CF93DF932E :10270000D82FC62F8091D7050E94C1166D2F82E564 :1027100095E00E940C0B6C2F82E595E00E940C0B5B :1027200081E0DF91CF910C946516CF93DF931F92D8 :10273000CDB7DEB7BE016F5F7F4F8EE00E94CB1634 :10274000898187FF04C091E09093DC0502C010925C :10275000DC0586FF04C091E09093DD0502C0109275 :10276000DD0585FF04C091E09093DE0502C0109264 :10277000DE0584FF04C091E09093DF0502C0109253 :10278000DF0583FF04C091E09093E00502C0109242 :10279000E00582FF04C091E09093E10502C0109231 :1027A000E1050F90DF91CF910895DF92EF92FF92B4 :1027B0000F931F93CF93DF9300D01F92CDB7DEB757 :1027C0008C01F62E21E062130AC0FC0180818F7714 :1027D0000E949D0E8983682F87E00E947E13F80176 :1027E000D1808D2D8F770E949D0E8983F801E48022 :1027F000F2E0EF1206C0F80182810E949D0E8F73F5 :102800000DC0F8018281E11005C00E949D0E8F75F8 :10281000806404C00E949D0E8F7780668A832D2D70 :10282000F80142816E2D83810E944E120E949D0EFE :10283000F8019381911102C0806801C080648B838C :10284000F1E0FF1202C088E001C08BE043E0BE016E :102850006F5F7F4F0E94741088E00E94F30FF801B1 :102860009381F1E0FF1204C0282F2C7F292B06C092 :1028700044E0949F90011124837F282B2983698150 :1028800088E00E949D10F80115810E949513682F21 :1028900081E08093E105F81621F0F2E0FF1639F0AF :1028A0000FC0112311F0656008C06E7F05C01123B1 :1028B00011F0666002C06D7F64608EE00E947E133E :1028C00081E00F900F900F90DF91CF911F910F91AA :1028D000FF90EF90DF900895CF93DF93EC0161308C :1028E00039F0623071F462E00E94D51362E004C0F6 :1028F00061E00E94D51361E0CE01DF91CF910C948D :10290000B21282E0DF91CF910895CF93DF93BC01A3 :1029100085EB94E00E947F0BEC016DED71E085EB9F :1029200094E00E947F0B8C0F9D1FDF91CF91089543 :10293000CF92DF92EF92FF920F931F93CF93DF938B :10294000CDB7DEB727970FB6F894DEBF0FBECDBF69 :102950008C01FC01F680D480E5802F2D30E02053DF :10296000384F81E090E0F2E0FE1510F480E090E056 :10297000281B390BEE2DF0E0EE0FFF1FEB59FE4F39 :102980000190F081E02DE20FF31FED0DF11DB90173 :102990007695679576956795E60FF71FC90160E90B :1029A00071E00E94E225E60FF71FC90164E670E0BE :1029B0000E94E225CF01861B970B67E070E00E9422 :1029C000E225CC24C394C80EF80180810E949D0E9C :1029D0008983F80181810E949D0E8A83F801878195 :1029E000823029F482810E949D0E8F730EC0F801FF :1029F000811106C082810E949D0E8F75806405C082 :102A000082810E949D0E8F7780668B838C2D0E9421 :102A10009D0E8C838D2D0E949D0E8D83F3E68E2D51 :102A2000FF1528F00E949D0E8E838F2D06C00E94F8 :102A30009D0E80688E838CE98F0D0E949D0E8F8382 :102A400047E0BE016F5F7F4F80E00E9474102796C1 :102A50000FB6F894DEBF0FBECDBFDF91CF911F91AF :102A60000F91FF90EF90DF90CF9008951F93CF9339 :102A7000DF93EC01862F6C8360E00E94AC1911E0BB :102A80001F838EE190E09A8F898F0E94221A6D8BAE :102A90007E8B8F8B988F1D8361E08C810E947D19C6 :102AA0001E828D81811101C01E831C8E1B8E1E8E85 :102AB0001D8E18A21F8E1AA219A21CA21BA21D866F :102AC0001E861F86188A1EA21DA281E08FA318866B :102AD000DF91CF911F91089540E0682F83EE95E03C :102AE0000C94160D81E00E946C158BE39FE1019719 :102AF000F1F70895E3EEF5E08089982F9460908BCC :102B00008C600C946C15CF93DF93823028F09091F9 :102B1000F20598609093F2058093F6051092F70500 :102B200080E48093F80580E18093F90580E5809347 :102B3000FA0561E08091E7050E94AC198091E805F3 :102B40008F3F19F061E00E94AC1961E08091E905C6 :102B50000E94AC19C3EED5E09E01235E3540809102 :102B6000F20584FD03C084E090E002C088E090E0BC :102B70002196281739072CF461E08E810E94AC1948 :102B8000EBCF8BE39DE00197F1F760E08091E705E3 :102B90000E947D1960E08091E9050E947D19809175 :102BA000E8058F3F19F060E00E947D198091F205E1 :102BB00084FD20C063E083EE95E00E94E90CCBE445 :102BC000D6E4CE010197F1F763E083EE95E00E9431 :102BD000E90C2197F1F763E083EE95E00E94E90CA0 :102BE00083E592E00197F1F762E083EE95E00E94C1 :102BF000E90C15C080620E946C158BE496E4019785 :102C0000F1F78091F20580620E946C1583E592E0F5 :102C10000197F1F78091F20580620E946C15809116 :102C2000F20580620E946C1584E08093F3050E9497 :102C30007A150E94721582E08093F40586E0DF9198 :102C4000CF910C946C159091B4049111FCCF91E04C :102C50009093B4044093B3042FEF2093B2041092E6 :102C6000B104260F2093B0049093AF049091AF0469 :102C7000880F892B8093AF048091AE04813061F47A :102C80001092AE048091AF048093BB008091BC0091 :102C900083FDF8CF85EC01C085EE8093BC00809168 :102CA000B4048130E1F38091B104861710F460918F :102CB000B104AEE8B4E0EEE6F4E080E0861721F07F :102CC0009D9191938F5FFACF0895282F30916D04D5 :102CD000313208F04AC08091B4048111FCCF909148 :102CE000FB0542E04093B4042093B3042FEF2093FC :102CF000B2041092B1043093B004EDE4F4E0AEE815 :102D0000B4E020E0321721F041914D932F5FFACFCC :102D10001092AF042091AF04990F922B9093AF04BF :102D20009091AE04913061F41092AE049091AF0492 :102D30009093BB009091BC0093FDF8CF95EC01C03F :102D400095EE9093BC009091B4049230E1F3909191 :102D5000B2049F3F79F08091B204803241F08091BB :102D6000B204803331F084E005C081E003C082E02A :102D700001C083E010924C0410926D0410924B0439 :102D8000089591E090934B048093FB0510924C04BE :102D900010926D0408950F931F93CF93DF93C82F64 :102DA0008B018091D7050E94C1166C2F82E595E0BA :102DB0000E940C0B80E00E946516C82F811112C082 :102DC00041E061E08091D7050E942316D82F109230 :102DD0004A048093490482E595E00E94C30AF80101 :102DE000808301C0D0E0F0E1CF9FC00111248D2B82 :102DF000DF91CF911F910F91089581E00C9465169A :102E0000682F82E595E00C940C0B833081F028F458 :102E1000813099F08230A1F008958730A9F0883090 :102E2000B9F08430D1F4809180008F7D03C080910F :102E300080008F7780938000089584B58F7702C0DB :102E400084B58F7D84BD08958091B0008F7703C0D5 :102E50008091B0008F7D8093B00008953FB7F894C3 :102E60008091010690910206A0910306B09104069C :102E700026B5A89B05C02F3F19F00196A11DB11DD5 :102E80003FBFBA2FA92F982F8827820F911DA11D10 :102E9000B11DBC01CD0142E0660F771F881F991F4D :102EA0004A95D1F708951F93CF93DF93CDB7DEB73F :102EB00028970FB6F894DEBF0FBECDBF182F0E9423 :102EC000F01129833A834B835C836D838F839887CA :102ED000872F90E0112329F001968D3091055CF445 :102EE0000CC001978D30910534F4181619062CF09A :102EF0008CE090E002C081E090E08E83CE010196EC :102F00000E94981428960FB6F894DEBF0FBECDBF6E :102F1000DF91CF911F9108951F93CF93DF93CDB78A :102F2000DEB728970FB6F894DEBF0FBECDBF182FBF :102F30000E94F01129833A834B835C837E838F83C5 :102F40009887262F30E0763051F028F4723049F01F :102F50007430A9F404C0793011F07B3081F48EE133 :102F600013C040ED480F842F837059F4842F64E61A :102F70000E94D625911107C0442329F002C08FE199 :102F800003C08CE101C08DE190E0B901112319F07B :102F90006F5F7F4F06C061507109161617060CF05F :102FA000BC018617970714F461E070E06D83CE01D1 :102FB00001960E94981428960FB6F894DEBF0FBEB3 :102FC000CDBFDF91CF911F9108951F93CF93DF93D2 :102FD000CDB7DEB728970FB6F894DEBF0FBECDBFD2 :102FE000182F0E94F01129833A834B835C836D83F1 :102FF0007E83988790E0112311F0019601C001971C :103000008231910534F0883C91052CF082E190E00A :1030100002C087EC90E08F83CE0101960E94981445 :1030200028960FB6F894DEBF0FBECDBFDF91CF91CB :103030001F9108951F93CF93DF93CDB7DEB72797E6 :103040000FB6F894DEBF0FBECDBF182F8130C1F090 :10305000823009F04EC081E08093DB0582E00E945F :10306000C71029833A834B835C836D837E83BE01C3 :10307000695F7F4F8FE00E94CB166F816D7F13C019 :103080008093DA0581E00E94C71029833A834B833D :103090005C836D837E83BE01695F7F4F8FE00E94FA :1030A000CB166F816E7F6F838FE00E947E138A81C3 :1030B000875F8C3318F09B819F5F9B836CE30E943A :1030C000D6259A839D818B81923041F02CE0622F2E :1030D0000E94D625911105C02B8304C068E10E948F :1030E000D6259B83612FCE0101960E94D51381E0E6 :1030F00001C082E027960FB6F894DEBF0FBECDBFA9 :10310000DF91CF911F910895643008F063E09091B2 :10311000F605691710F06FEF690FE62FF0E0ED513B :10312000FA4F9489890F80680C946C15EF92FF9286 :103130000F931F93CF93DF93CDB7DEB762970FB690 :10314000F894DEBF0FBECDBF8C01CB01F801118218 :10315000108213821282158214824AE09E012F5F30 :103160003F4F7901B9010E94F020F7010190002042 :10317000E9F73197AF014E195F09B701C8010E9405 :10318000DC0862960FB6F894DEBF0FBECDBFDF91AC :10319000CF911F910F91FF90EF900895FC01448112 :1031A00055816081718183EE95E00C947309CF9312 :1031B000DF931F92CDB7DEB7BE016F5F7F4F8FE009 :1031C0000E94CB1669816F7769838FE00E947E131E :1031D0000F90DF91CF910895E3EEF5E080898E7F27 :1031E000808B88600C946C15E3EEF5E080898D7F10 :1031F000808B88600C946C15CF93DF9300D000D047 :1032000000D0CDB7DEB719821A8296E09B8391E099 :103210009C831D821E82682FCE0101960E946C1431 :1032200026960FB6F894DEBF0FBECDBFDF91CF91CB :103230000895CF93DF9300D000D000D0CDB7DEB794 :103240009FEF980F923048F40E942F1181E04D308B :1032500010F4411103C0623009F080E026960FB6E9 :10326000F894DEBF0FBECDBFDF91CF9108950F93CD :103270001F93CF93DF938B01877028E0829FC0015B :10328000112480640E946C15E801085F1F4F69914A :1032900083EE95E00E94690DC017D107C1F7DF9159 :1032A000CF911F910F910895CF93DF93282F30E096 :1032B000F901EB51FE4F8491F901EF52FE4FD49189 :1032C000F901E354FE4FC491CC2391F081110E9487 :1032D0000517EC2FF0E0EE0FFF1FED54FE4FA59108 :1032E000B491EC91ED2381E090E021F480E002C004 :1032F00080E090E0DF91CF9108951F93CF93DF930B :10330000282F30E0F901EB51FE4F8491F901EF5283 :10331000FE4FD491F901E354FE4FC491CC23C1F088 :10332000162F81110E940517EC2FF0E0EE0FFF1F02 :10333000E755FE4FA591B4919FB7F894111104C0C1 :103340008C91D095D82302C0EC91DE2BDC939FBFEB :10335000DF91CF911F910895CF93DF9390E0FC010F :10336000EF52FE4F2491FC01E354FE4F84918823D9 :1033700061F190E0880F991FFC01E156FE4FC59165 :10338000D491FC01E755FE4FA591B491611109C09C :103390009FB7F8948881209582238883EC912E230F :1033A0000BC0623061F49FB7F8948881322F30955A :1033B00083238883EC912E2B2C939FBF06C08FB75D :1033C000F894E8812E2B28838FBFDF91CF91089549 :1033D0008F929F92AF92BF92CF92DF92EF92FF9225 :1033E0006B017C010E942E174B015C01C114D104BA :1033F000E104F104F1F00E942E17DC01CB018819E1 :103400009909AA09BB09883E9340A105B10570F34B :1034100021E0C21AD108E108F10888EE880E83E0A5 :10342000981EA11CB11CC114D104E104F10419F7C8 :10343000DDCFFF90EF90DF90CF90BF90AF909F9047 :103440008F9008952FB7F8946091FD057091FE0557 :103450008091FF05909100062FBF08951F920F9253 :103460000FB60F9211242F933F938F939F93AF9397 :10347000BF938091FD059091FE05A091FF05B0914D :1034800000063091FC0523E0230F2D3720F4019630 :10349000A11DB11D05C026E8230F0296A11DB11D77 :1034A0002093FC058093FD059093FE05A093FF05F6 :1034B000B09300068091010690910206A091030648 :1034C000B09104060196A11DB11D80930106909351 :1034D0000206A0930306B0930406BF91AF919F919B :1034E0008F913F912F910F900FBE0F901F901895C5 :1034F000CF93DF93CDB7DEB769970FB6F894DEBFF1 :103500000FBECDBF789484B5826084BD84B58160E0 :1035100084BD85B5826085BD85B5816085BD80919E :103520006E00816080936E00109281008091810016 :10353000826080938100809181008160809381000E :10354000809180008160809380008091B1008460D0 :103550008093B1008091B00081608093B000809131 :103560007A00846080937A0080917A0082608093F0 :103570007A0080917A00816080937A0080917A004D :10358000806880937A001092C1000E94221A609392 :10359000E7037093E8038093E9039093EA03E091D3 :1035A000C504F091C60482E08083E091C104F091EB :1035B000C2041082E091C304F091C4048FEC8083B4 :1035C0001092CD04E091C904F091CA0486E0808392 :1035D000E091C704F091C804808180618083E0910C :1035E000C704F091C804808188608083E091C7049B :1035F000F091C804808180688083E091C704F091D5 :10360000C80480818F7D808383EB92E00E948514C3 :1036100061E08DE00E94AC1960E08DE00E947D19B0 :1036200061E08CE00E94AC1960E08CE00E947D19A2 :1036300082E00E94831568E171E081E00E94371901 :1036400060E171E082E00E94371968E071E083E098 :103650000E94371960E071E084E00E9437191092EF :103660004A041092490410924C0410926D04109276 :10367000B40481E08093B3041092AE0461E082E16F :103680000E947D1961E083E10E947D198091B9005B :103690008E7F8093B9008091B9008D7F8093B900AF :1036A00088E48093B80085E48093BC0081EB9AE0C5 :1036B0009093E2038093E10382EB9AE09093E0031E :1036C0008093DF030E949513682F64608EE00E9450 :1036D0007E130E9495131092DA051092DB05BE014D :1036E000615F7F4F85E00E94CB168F8587FD02C00A :1036F00010E001C014E6BE01615F7F4F86E00E94CA :10370000CB168F850E94A70E810F8231D0F41982CB :103710001A828CE08B8382E08C8381E08D838E83A0 :1037200082E18F831886CE0101960E9498146CE185 :103730008EE00E947E130E94951381E00E94FC1887 :103740002BC081E00E941919882379F081E00E9442 :103750002F1129833A834B835C836D837E8361E0E1 :10376000CE0101960E946C1403C081E00E94FC18F7 :1037700082E00E941919882379F082E00E942F11BB :1037800029833A834B835C836D837E8362E0CE0121 :1037900001960E946C1403C082E00E94FC18BE01D6 :1037A0006F5F7F4F8FE00E94CB16898187FF08C033 :1037B00010922501109224018FEB92E00E94851453 :1037C0000E94EF0E6093E3037093E4038093E5039C :1037D0009093E6034FE657E05093A7054093A60564 :1037E00028EB3BE0309388052093870580E696E040 :1037F0009093AB058093AA0550937F0540937E0577 :103800003093600520935F05909383058093820534 :103810005093CF054093CE053093B0052093AF056C :103820009093D3058093D20581E00E94A3046FECAE :1038300072E085EB94E00E94DD0B0E949513482F07 :1038400050E060E070E022E085EB94E00E94940B91 :103850006DED71E085EB94E00E947F0B60EE72E00D :1038600085EB94E00E94DD0BBE016F5F7F4F8FE020 :103870000E94CB16498150E060E070E022E085EBC9 :1038800094E00E94940B6DED71E085EB94E00E9452 :103890007F0B81EF92E00E948514E0912401F0916A :1038A0002501E830F10508F02CC3E65BFF4F80915D :1038B0002201909123010C944B26892B61F08BEF10 :1038C00092E00E94851480912401909125019093AB :1038D00023018093220180E00E94A3040E94221A07 :1038E000C0900204D0900304E0900404F09005041A :1038F000DC01CB018C199D09AE09BF09883E9340BC :10390000A105B10508F404C30E94221A60930204C1 :103910007093030480930404909305041091210193 :10392000112349F08091F3058B7F8093F305886024 :103930000E946C1502C00E947A1581E0182710932E :103940002101E6C2019709F4E0C282E193E00E94FE :1039500085148091240190912501909323018093F7 :103960002201D3C2029761F089E293E00E9485149C :10397000809124019091250190932301809322014D :103980000E94221AC090ED03D090EE03E090EF0366 :10399000F090F003DC01CB018C199D09AE09BF0941 :1039A000813D9740A105B10528F591C2039761F0CB :1039B00081E493E00E948514809124019091250177 :1039C00090932301809322010E94221AC090ED035C :1039D000D090EE03E090EF03F090F003DC01CB0118 :1039E0008C199D09AE09BF09813D9740A105B1051C :1039F00008F484C281E090E0909325018093240133 :103A000085C2049761F089E593E00E948514809156 :103A1000240190912501909323018093220180E05D :103A20000E94A3040E94221AC0900204D0900304B2 :103A3000E0900404F0900504DC01CB018C199D0991 :103A4000AE09BF09883E9340A105B10508F460C2E4 :103A50000E94221A6093020470930304809304046A :103A60009093050410912101112349F08091F305F1 :103A70008B7F8093F30588600E946C1502C00E94C2 :103A80007A1581E01827109321018DE00E945419C6 :103A900061E0892B09F060E08DE00E947D198DE5E1 :103AA00091E0998B888BA3E5B1E0BF8BAE8BE88961 :103AB000F98961917191F98BE88B88EE93E00E940E :103AC000F625798F688FCB01092E000CAA0BBB0B52 :103AD0008A8B9B8BAC8BBD8BAE89BF892D903D9023 :103AE000BF8BAE8B809120018C3021F08F3F09F08D :103AF00088C104C0EEE9F1E0149172C08CE08093BB :103B00002001EEE9F1E014911F3F09F47AC1113070 :103B100009F442C038F1123009F062C01092B000CE :103B20001092B1008091B00082608093B0008091CB :103B3000B10081608093B100E9ECF1E08491E82F5D :103B4000F0E0EE0FFF1FE755FE4F859194919093A3 :103B5000F3038093F203EDEDF1E084918093F103A0 :103B600012E0A4C214BC15BC84B5826084BD85B5C6 :103B7000816085BDE9ECF1E08491E82FF0E0EE0F83 :103B8000FF1FE755FE4F85919491EDEDF1E0849193 :103B90008093F50310E08AC2109280001092810099 :103BA0008091810088608093810080918100816094 :103BB00080938100E9ECF1E08491E82FF0E0EE0FD2 :103BC000FF1FE755FE4F85919491EDEDF1E0849153 :103BD0008093F40361E08CE00E94AC1911E084C092 :103BE00017FD0FC161E08CE00E94AC19812F8D7F21 :103BF00009F07AC04101A12CB12C60E072E18AE7A2 :103C000090E0A50194010E942C2629013A01690146 :103C10007A01F1E0CF1AD108E108F1082FEFC216BE :103C2000D104E104F10409F008F44CC060E472E44A :103C30008FE090E0A50194010E942C2669017A0191 :103C400081E0C81AD108E108F108123009F59FEFA8 :103C5000C916D104E104F10409F008F4F0C160E9E7 :103C600070ED83E090E0A50194010E942C2669018B :103C70007A01A1E0CA1AD108E108F108BFEFCB161A :103C8000D104E104F10411F008F068C183E025C01B :103C9000EFEFCE16D104E104F104B1F0A8F068E42E :103CA00078EE81E090E0A50194010E942C26690144 :103CB0007A01F1E0CF1AD108E108F108112309F4E3 :103CC000C0C18BC181E001C082E0111106C095B571 :103CD000987F892B85BD46C085E09091B100987F83 :103CE000892B8093B1003EC04101A12CB12C60E032 :103CF00072E18AE790E0A50194010E942C266901F7 :103D00007A01B1E0CB1AD108E108F108C114D1045D :103D1000E1E0EE06F10488F068E478EE81E090E0FE :103D2000A50194010E942C2669017A01F1E0CF1AC5 :103D3000D108E108F10883E001C081E0113091F47D :103D400090918100987F892B809381008A899B893B :103D5000AC89BD89892B8A2B8B2B61F42FEF3FEF28 :103D6000A9012EC08A899B89AC89BD89892B8A2BA0 :103D70008B2B71F09101220F331FA88DB98D0E94FA :103D8000512628EE33E040E050E00E940A2603C0AE :103D90002FEF3FEFA901113099F0123019F11111F5 :103DA00030C0C7BC2093FE033093FF034093000450 :103DB0005093010480916E00826080936E0021C058 :103DC000D0928900C09288002093FA033093FB03BD :103DD0004093FC035093FD0380916F0082608093B9 :103DE0006F000FC0C092B3002093F6033093F70327 :103DF0004093F8035093F9038091700082608093A0 :103E000070006A897B898C899D890E945E2326E6E1 :103E100036E646EA5FE30E94BD230E94A025072EF6 :103E2000000C880B990B0E94E8198CE00E94540B3F :103E3000A889B989A756B14009F039CE69C005975C :103E400061F08CE693E00E948514809124019091AA :103E5000250190932301809322018091EC039EE041 :103E6000E5E4F1E0DE01119601900D929A95E1F7FB :103E7000FE013196E80FF11DE80FF11D618180818F :103E80000E9484188091F305982F92609093F30517 :103E90008A600E946C158091F305982F9160909331 :103EA000F30589600E946C1530C0069761F083E8C5 :103EB00093E00E94851480912401909125019093B4 :103EC0002301809322018091EC030E94A90360E00A :103ED00081E00E94E4031CC0079761F08BE993E046 :103EE0000E948514809124019091250190932301D3 :103EF000809322018091EC030E94A90360E082E09C :103F0000E8CF83EB93E00E94851480E00E94A30435 :103F100087E895E00E94370C8FE595E00E94370C0A :103F20008FEA95E00E94370C82E00E9454197C01D0 :103F30001982BE016F5F7F4F8FE00E94CB1689818F :103F40008370EF2831F424E030E030932501209392 :103F500024018093EB030E94750A9FCC68E478EEFD :103F600081E090E0A50194010E942C2669017A016C :103F7000F1E0CF1AD108E108F1082FEFC216D10401 :103F8000E104F10441F138F164E274EF80E090E083 :103F9000A50194010E942C2669017A0181E0C81ACA :103FA000D108E108F1089FEFC916D104E104F1043A :103FB00009F008F491CE62E17AE780E090E0A50193 :103FC00094010E942C2669017A01A1E0CA1AD10845 :103FD000E108F10819C084E080CEEFEFCE16D104DD :103FE000E104F10409F008F45FC062E17AE780E0DF :103FF00090E0A50194010E942C2669017A01B1E0AC :10400000CB1AD108E108F1082FEFC216D104E10460 :10401000F10499F090F0D301C2012AE0B595A7957B :10402000979587952A95D1F76C017D01F1E0CF1A1C :10403000D108E108F10887E050CE86E04ECE82E05C :104040004CCEAFEFCA16D104E104F10459F150F19E :1040500062E17AE780E090E0A50194010E942C26BD :1040600069017A0181E0C81AD108E108F1089FEFDF :10407000C916D104E104F10499F090F0D301C20112 :104080003AE0B595A795979587953A95D1F76C0144 :104090007D01E1E0CE1AD108E108F10885E017CEF4 :1040A00084E015CE83E013CE84E00FCE61E08CE097 :1040B0000E94AC199FCDE5EBF4E01382128288EEEA :1040C00093E0A0E0B0E084839583A683B78323E8E0 :1040D00031E03183208325EC30E03587248724ECE0 :1040E00030E03787268720EC30E0318B208B21ECC5 :1040F00030E0338B228B22EC30E0358B248B26ECA6 :1041000030E0378B268B118E128E138E148EE2E5E3 :10411000F5E01382128284839583A683B78385E9B1 :1041200091E091838083E3EEF5E01382128287EAC7 :1041300091E09183808383E084838FEF858384E0A3 :10414000868385E0878386E0808787E0818788E0B3 :1041500082871386148615861686178681E00E944C :104160008315E7EDF5E081E0828390E2938798E69E :10417000908397E5918382876BE08FEA95E00E94B8 :10418000361569E087E895E00E9436156AE08FE50C :1041900095E00E9436158091260180935E05089572 :1041A000EF920F931F93CF93DF93E80147FD02C077 :1041B00034E001C034E1042E000C550B57FF03C05E :1041C000519541955109E32E022F242FAE010E94F3 :1041D0001521CE01DF91CF911F910F91EF9008959E :1041E000BB274A3031F4992322F4BDE290958195A2 :1041F0009F4F0C94FC20BB27FB015527AA27880F53 :10420000991FAA1FA41710F0A41B83955051B9F74A :10421000A05DAA3308F0A95DA193009779F7B111C9 :10422000B1931192CB010C944723A9E0B0E0EBE1EC :10423000F1E20C9481246A01122FB02E2BE3201797 :1042400020F0FF24F394F00E02C02CE3F22E0F2D89 :1042500027E0AE014F5F5F4F0E946F22BC01498192 :10426000842F8970813031F0E1FC06C0E0FE06C089 :1042700090E205C09DE203C09BE201C090E05E2D8C :10428000507143FF3CC0911102C083E001C084E043 :10429000811718F4212F281B01C020E051110BC0F9 :1042A000F601822F30E2882319F031938150FBCF41 :1042B000C20ED11C20E0992329F0D6019C93F6016F :1042C00031966F01C6010396E2FE0AC03EE4D601B4 :1042D0003C9341E411964C93119712963C9306C07F :1042E0003EE6F601308341E641833283FC01322F02 :1042F00040E2332309F442C041933150FACF42FFE8 :1043000044C0911102C083E001C084E0811718F419 :10431000212F281B01C020E051110BC0F601822F74 :1043200030E2882319F031938150FBCFC20ED11CAB :1043300020E0992329F0D6019C93F60131966F0174 :10434000C6010396E2FE0BC039E4D6013C933EE47D :1043500011963C93119736E412963C9307C039E6C8 :10436000F60130833EE6318336E63283FC01322F9C :1043700040E2332319F041933150FBCFFC01E20FAF :10438000F11D10828EEF9FEFA6C021E030E0911169 :1043900002C020E030E0161617061CF4FB0131962F :1043A00002C0E1E0F0E02E0F3F1FBB2021F0EB2D1B :1043B000F0E0319602C0E0E0F0E02E0F3F1FE12F69 :1043C000F0E02E173F071CF4121B212F01C020E044 :1043D0008E2D887159F4F601822F30E2882319F06E :1043E00031938150FBCFC20ED11C20E0992329F0DC :1043F000D6019C93F60131966F0151110BC0F60165 :10440000822F90E3882319F091938150FBCFC20E45 :10441000D11C20E00F2D060F9A81342F307144FFFC :1044200003C0913309F40150101624F4093018F038 :1044300008E001C001E0AB0177FF02C040E050E0BE :10444000FB01E41BF50BA1E0B0E0AC0FBD1FEA0FD0 :10445000FB1F8EE2A82E4B01801A91080B2D10E055 :104460001195019511094F3FBFEF5B0721F4D6016C :10447000AC9211966D01641775072CF084169506A1 :1044800014F4818101C080E3415051093196D60175 :1044900011967D014017510724F0D6018C936701D6 :1044A000E2CF6417750739F4963320F4953319F485 :1044B000311101C081E3F6018083F701822F90E280 :1044C000882319F091938150FBCFF701E20FF11D82 :1044D000108280E090E02996ECE00C949D24283036 :1044E00008F027E03327DA01990F311D87FD91602D :1044F00000966105710539F432602E5F3D9330E31B :104500002A95E1F708959F3F30F0803871056105E5 :1045100009F03C5F3C5F3D93913008F08068911D4D :10452000DF93CF931F930F93FF92EF92192F987FF2 :104530009695E92F96959695E90FFF27E250FF4F44 :1045400099273327EE24FF24A701E701059008945B :10455000079428F4360FE71EF81E491F511D660FF9 :10456000771F881F991F0694A1F70590079428F4D8 :10457000E70EF81E491F561FC11D770F881F991F90 :10458000661F0694A1F70590079428F4F80E491FBA :10459000561FC71FD11D880F991F661F771F0694CE :1045A000A1F70590079420F4490F561FC71FD81F85 :1045B000990F661F771F881F0694A9F7849110959D :1045C000177041F0D695C79557954795F794E7949E :1045D0001A95C1F7E4EAF0E06894159015913591C9 :1045E0006591959105907FE27395E118F10A430B6F :1045F000560BC90BD009C0F7E10CF11E431F561F23 :10460000C91FD01D7EF4703311F48A95E6CFE8946B :10461000015030F0080F0AF40027021708F4202F89 :104620002395022F7A3328F079E37D932A95E9F7D1 :1046300010C07D932A9589F60694979567953795CE :1046400017951794E118F10A430B560BC90BD009C3 :1046500098F023957E9173957A3308F070E37C93FC :104660002013B8F77E9170617D9330F0839571E3EC :104670007D9370E32A95E1F71124EF90FF900F915D :104680001F91CF91DF91992787FD90950895DC01C7 :10469000FC01672F71917723E1F7329704C07C9179 :1046A0006D9370836291AE17BF07C8F308950E949F :1046B000992308F481E00895E89409C097FB3EF43B :1046C00090958095709561957F4F8F4F9F4F99235F :1046D000A9F0F92F96E9BB279395F69587957795DD :1046E0006795B795F111F8CFFAF4BB0F11F460FF9D :1046F0001BC06F5F7F4F8F4F9F4F16C0882311F0F5 :1047000096E911C0772321F09EE8872F762F05C008 :10471000662371F096E8862F70E060E02AF09A95A3 :10472000660F771F881FDAF7880F9695879597F998 :104730000895990F0008550FAA0BE0E8FEEF161632 :104740001706E807F907C0F012161306E407F50785 :1047500098F0621B730B840B950B39F40A2661F0F9 :10476000232B242B252B21F408950A2609F4A1409C :10477000A6958FEF811D811D08950E94D0230C9472 :1047800041240E94332438F00E943A2420F09523DB :1047900011F00C942A240C94302411240C947524C8 :1047A0000E94522470F3959FC1F3950F50E0551F5E :1047B000629FF001729FBB27F00DB11D639FAA2776 :1047C000F00DB11DAA1F649F6627B00DA11D661FC5 :1047D000829F2227B00DA11D621F739FB00DA11DE6 :1047E000621F839FA00D611D221F749F3327A00DA0 :1047F000611D231F849F600D211D822F762F6A2F3C :1048000011249F5750409AF0F1F088234AF0EE0FA0 :10481000FF1FBB1F661F771F881F91505040A9F7CD :104820009E3F510580F00C942A240C9475245F3F20 :10483000E4F3983ED4F3869577956795B795F79509 :10484000E7959F5FC1F7FE2B880F911D9695879581 :1048500097F9089597F99F6780E870E060E0089500 :104860009FEF80EC089500240A9416161706180688 :104870000906089500240A94121613061406050664 :104880000895092E0394000C11F4882352F0BB0FF5 :1048900040F4BF2B11F460FF04C06F5F7F4F8F4F58 :1048A0009F4F089557FD9058440F551F59F05F3F93 :1048B00071F04795880F97FB991F61F09F3F79F042 :1048C00087950895121613061406551FF2CF4695C4 :1048D000F1DF08C0161617061806991FF1CF869546 :1048E0007105610508940895E894BB27662777272A :1048F000CB0197F908952F923F924F925F926F925A :104900007F928F929F92AF92BF92CF92DF92EF925F :10491000FF920F931F93CF93DF93CDB7DEB7CA1BE0 :10492000DB0B0FB6F894DEBF0FBECDBF09942A880B :10493000398848885F846E847D848C849B84AA84B3 :10494000B984C884DF80EE80FD800C811B81AA8140 :10495000B981CE0FD11D0FB6F894DEBF0FBECDBF0B :10496000ED010895A29FB001B39FC001A39F700DF8 :10497000811D1124911DB29F700D811D1124911D67 :1049800008955058BB27AA270E94D9240C9441248B :104990000E94332438F00E943A2420F039F49F3FDB :1049A00019F426F40C9430240EF4E095E7FB0C94F3 :1049B0002A24E92F0E94522458F3BA17620773077A :1049C0008407950720F079F4A6F50C9474240EF46E :1049D000E0950B2EBA2FA02D0B01B90190010C010F :1049E000CA01A0011124FF27591B99F0593F50F427 :1049F000503E68F11A16F040A22F232F342F44277F :104A0000585FF3CF469537952795A795F040539576 :104A1000C9F77EF41F16BA0B620B730B840BBAF046 :104A20009150A1F0FF0FBB1F661F771F881FC2F7B1 :104A30000EC0BA0F621F731F841F48F487957795C5 :104A40006795B795F7959E3F08F0B0CF9395880F7F :104A500008F09927EE0F9795879508950E944225B3 :104A60000C9441240E943A2458F00E94332440F0D0 :104A700029F45F3F29F00C942A2451110C947524D9 :104A80000C9430240E94522468F39923B1F35523E7 :104A900091F3951B550BBB27AA2762177307840751 :104AA00038F09F5F5F4F220F331F441FAA1FA9F3E7 :104AB00035D00E2E3AF0E0E832D091505040E695D5 :104AC000001CCAF72BD0FE2F29D0660F771F881F36 :104AD000BB1F261737074807AB07B0E809F0BB0B29 :104AE000802DBF01FF2793585F4F3AF09E3F51053D :104AF00078F00C942A240C9475245F3FE4F3983EDC :104B0000D4F3869577956795B795F7959F5FC9F725 :104B1000880F911D9695879597F90895E1E0660FA6 :104B2000771F881FBB1F621773078407BA0720F01F :104B3000621B730B840BBA0BEE1F88F7E095089588 :104B40000E94A7256894B1110C94752408950E94C1 :104B50005A2488F09F5798F0B92F9927B751B0F091 :104B6000E1F0660F771F881F991F1AF0BA95C9F7F1 :104B700014C0B13091F00E947424B1E008950C94F7 :104B80007424672F782F8827B85F39F0B93FCCF3AA :104B9000869577956795B395D9F73EF4909580956E :104BA000709561957F4F8F4F9F4F0895991B79E0C6 :104BB00004C0991F961708F0961B881F7A95C9F7AD :104BC00080950895AA1BBB1B51E107C0AA1FBB1FFC :104BD000A617B70710F0A61BB70B881F991F5A9589 :104BE000A9F780959095BC01CD01089597FB072EFC :104BF00016F4009407D077FD09D00E94E22507FC47 :104C000005D03EF4909581959F4F089570956195DC :104C10007F4F0895A1E21A2EAA1BBB1BFD010DC0F8 :104C2000AA1FBB1FEE1FFF1FA217B307E407F5075C :104C300020F0A21BB30BE40BF50B661F771F881F38 :104C4000991F1A9469F760957095809590959B01CE :104C5000AC01BD01CF010895052E97FB1EF4009411 :104C60000E94432657FD07D00E940A2607FC03D066 :104C70004EF40C94432650954095309521953F4F26 :104C80004F4F5F4F089590958095709561957F4F38 :104C90008F4F9F4F0895EE0FFF1F0590F491E02D69 :104CA00009940E94B224B7FF0895821B930B0895C4 :104CB0000F931F93CF93DF938230910510F482E01E :104CC00090E0E0910706F091080620E030E0A0E0D7 :104CD000B0E0309719F1408151810281138148176A :104CE0005907C8F08417950769F4109731F01296A8 :104CF0000C93129713961C9327C0009307061093EA :104D0000080622C02115310519F04217530718F47F :104D10009A01BD01EF01DF01F801DBCF211531055B :104D2000F9F0281B390B2430310580F48A819B81EE :104D30006115710521F0FB019383828304C0909378 :104D4000080680930706FE01329644C0FE01E20F7A :104D5000F31F8193919322503109398328833AC0FC :104D60002091050630910606232B41F4209129015C :104D700030912A01309306062093050620912701E1 :104D8000309128012115310541F42DB73EB74091EE :104D90002B0150912C01241B350BE0910506F0915D :104DA0000606E217F307A0F42E1B3F0B281739075E :104DB00078F0AC014E5F5F4F2417350748F04E0F77 :104DC0005F1F50930606409305068193919302C09E :104DD000E0E0F0E0CF01DF91CF911F910F910895B6 :104DE000CF93DF93009709F481C0FC0132971382BF :104DF0001282A0910706B0910806109781F42081D5 :104E00003181820F931F20910506309106062817E5 :104E1000390751F5F0930606E093050667C0ED01EA :104E200020E030E0CE17DF0740F44A815B819E012D :104E300041155105F1F0EA01F5CFD383C2834081DA :104E40005181840F951FC817D90759F4888199811A :104E5000840F951F0296918380838A819B8193831F :104E600082832115310529F4F0930806E0930706A3 :104E70003DC0E901FB83EA8349915991C40FD51FD5 :104E8000EC17FD0761F480819181840F951F0296D4 :104E9000E90199838883828193819B838A83E0E0FF :104EA000F0E012968D919C911397009719F0FD01F7 :104EB000DC01F7CF8D919C9111979D012E5F3F4FA3 :104EC000820F931F20910506309106062817390797 :104ED00069F4309729F4109208061092070602C070 :104EE00013821282B0930606A0930506DF91CF913C :104EF0000895A0E0B0E0EFE7F7E20C947F24EC0126 :104F0000009721F4CB010E945826B4C0FC01E60FA3 :104F1000F71F9C0122503109E217F30708F4A8C0DB :104F2000D9010D911C91119706171707B0F00530A4 :104F3000110508F49BC0C80104978617970708F469 :104F400095C002501109061B170B019311936D9325 :104F50007C93CF010E94F02689C05B01A01AB10AA0 :104F60004C01800E911EA0910706B0910806612C9D :104F7000712CE12CF12C109709F446C08D919C9175 :104F80001197A815B905B1F56C0142E0C40ED11C0A :104F9000CA14DB0478F14C018A189B08640142E0D2 :104FA000C40ED11C1296BC9012971396AC91B5E02A :104FB000CB16D10440F0B282A38391828082D901C2 :104FC0006D937C9309C00E5F1F4F800F911FF901F5 :104FD00091838083EB2DFA2FE114F10431F0D70196 :104FE0001396FC93EE93129741C0F0930806E0935A :104FF00007063CC06816790608F43C017D0112964C :105000000D90BC91A02DB7CF80910506909106061A :1050100088169906E1F466167706C8F48091270190 :1050200090912801009741F48DB79EB740912B01D4 :1050300050912C01841B950BE817F907C8F4F093E5 :105040000606E0930506F901718360830FC0CB016A :105050000E9458267C01009759F0A801BE010E94C9 :105060004428CE010E94F026C70104C0CE0102C030 :1050700080E090E0CDB7DEB7EEE00C949B2481E0B9 :1050800090E0F8940C945428FB01DC0102C00190DC :105090000D9241505040D8F70895FB01DC0101907A :0C50A0000D920020E1F70895F894FFCF76 :1050AC000002070507050500040E1F00001F0E0473 :1050BC0000000000001F0E04040E1F000000000082 :1050CC00FF01070001000100000906800001010436 :1050DC000107010901930297029B029F02A302A7F9 :1050EC0002AB02AF020100040007000F000501082B :1050FC00010D0117041704170417041704100010EE :10510C000010001000100000000300020005000059 :10511C00000300050001000400060002000400006A :10512C00000000060A73099D09530ACE09AC09C098 :10513C0009000000000C0BDF0A3B0BB30AD70AC3B3 :10514C000AB40A00000000690D73093B0BA0085358 :10515C006E6F6F7A65204163746976617465640063 :10516C0053657474696E6720416C61726D310061B6 :10517C006C61726D2E486F7572203D20000D0A0017 :10518C00456E64206368616E6765486F7572004197 :10519C006C61726D203200416C61726D2031004F78 :1051AC004E004F4646003A0020414D0020504D0025 :1051BC0020204D00204461696C7900205765656B97 :1051CC0064617900205765656B656E6400204F6ED5 :1051DC0063650020414D200020504D200020204DC3 :1051EC00200043002F00427574746F6E20486F6C62 :1051FC0064202D2000536E6F6F7A655F50696E00CE :10520C004C745F50696E0052745F50696E00427549 :10521C0074746F6E20436C69636B202D2000427593 :10522C0074746F6E20436C69636B2069676E6F7268 :10523C006564002D2D2D0053756E004D6F6E00545E :10524C0075650057656400546875004672690053B3 :10525C00617400536574757020426567696E005007 :10526C006F7765724C6F7373205374617465005261 :10527C00656769737465722030783045203D200075 :10528C0052656769737465722030783046203D2012 :10529C0000536574757020456E6400436C6F636BCE :1052AC005374617465203D20506F7765724C6F7339 :1052BC007300436C6F636B5374617465203D2053B2 :1052CC00686F77436C6F636B00436C6F636B5374E5 :1052DC00617465203D2053686F77416C61726D314C :1052EC0000436C6F636B5374617465203D2053688D :1052FC006F77416C61726D3200436C6F636B5374EA :10530C00617465203D20416C61726D00436C6F636C :10531C006B5374617465203D2045646974436C6FF4 :10532C00636B00436C6F636B5374617465203D2039 :10533C0045646974416C61726D3100436C6F636BD1 :10534C005374617465203D2045646974416C6172CD :10535C006D3200436C6F636B5374617465203D2038 :0C536C0064656661756C742121003000DE :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C :107E300020E33CEF91E0309385002093840096BBD3 :107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4 :107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7 :107E6000A2D0813461F49FD0082FAFD0023811F036 :107E7000013811F484E001C083E08DD089C08234E0 :107E800011F484E103C0853419F485E0A6D080C0E4 :107E9000853579F488D0E82EFF2485D0082F10E0AE :107EA000102F00270E291F29000F111F8ED06801E7 :107EB0006FC0863521F484E090D080E0DECF843638 :107EC00009F040C070D06FD0082F6DD080E0C81688 :107ED00080E7D80618F4F601B7BEE895C0E0D1E017 :107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8 :107EF00018F0F601B7BEE89568D007B600FCFDCFD4 :107F0000A601A0E0B1E02C9130E011968C91119780 :107F100090E0982F8827822B932B1296FA010C0160 :107F200087BEE89511244E5F5F4FF1E0A038BF0790 :107F300051F7F601A7BEE89507B600FCFDCF97BE46 :107F4000E89526C08437B1F42ED02DD0F82E2BD052 :107F50003CD0F601EF2C8F010F5F1F4F84911BD097 :107F6000EA94F801C1F70894C11CD11CFA94CF0C13 :107F7000D11C0EC0853739F428D08EE10CD085E9AC :107F80000AD08FE07ACF813511F488E018D01DD067 :107F900080E101D065CF982F8091C00085FFFCCF94 :107FA0009093C60008958091C00087FFFCCF809118 :107FB000C00084FD01C0A8958091C6000895E0E648 :107FC000F0E098E1908380830895EDDF803219F02E :107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA :107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6 :047FF000FF270994CA :027FFE00040479 :0400000300007E007B :00000001FF ================================================ FILE: Lesson 20 - Sound Sensor Module/README.md ================================================ # ElegooTutorial ## 20 Sound Sensor Module [![YouTube video](https://img.youtube.com/vi/y5X2zwbO6e4/0.jpg)](https://youtu.be/CbovaHqvdsM) [YouTube video](https://youtu.be/CbovaHqvdsM) KY-038 (KY-037) Sound Sensor Module. Demonstrate the Elegoo sketch provided in the tutorial covering the Sound Sensor Module and expand the sketch to include an LED and OLED meter. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the Sound Sensor Module, aka, KY-038 (perhaps wrongly identified as KY-037). Ill step through the Elegoo provided tutorial, briefly explain the code, and build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then will expand the sketch to include an LED an OLED voltage meter. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * KY-038 Analog and Digital output Sound Sensor Module (KY-037 typically only has a Digital output) * Four female-to-male jumper wires The next lesson will be Lesson 21: RC522 RFID Module ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Tutorial Using DS1307 and DS3231 Real-time Clock Modules with Arduino](https://tronixstuff.com/2014/12/01/tutorial-using-ds1307-and-ds3231-real-time-clock-modules-with-arduino/) * [Arduino and DS3231 real time clock with alarms, temperature monitor and remote control](https://www.youtube.com/watch?v=Ijk-Vy0n7ng) * [Forum Thread on ZS-042 module](https://forum.arduino.cc/index.php?topic=278270.0) * [List of Keyes Boards/Sensors for Arduino](https://rydepier.wordpress.com/2015/06/13/list-of-keyes-boardssensors-for-arduino/) * [TkkrLab Arduino 37 Sensors](https://tkkrlab.nl/wiki/Arduino_37_sensors) * [KY-038 Microphone sound sensor module](http://sensorkit.en.joy-it.net/index.php?title=KY-038_Microphone_sound_sensor_module) * [Basics: Project 016a Big sound sensor (KY 038 or KY 037)](http://acoptex.com/project/84/basics-project-016a-big-sound-sensor-ky-038-or-ky-037-at-acoptexcom/#sthash.iFTxCv96.dpbs) * [How to get audio from a sensor for an Arduino](https://electronics.stackexchange.com/questions/322503/how-to-get-audio-from-a-sensor-for-an-arduino/322661) * [KY-038 Schematic](https://easyeda.com/normal/KY_038_Microphone_sound_sensor_module-7189f5cb17f041c48c57c5e5daaec42e) * [Arduino Sound Meter by learnelectronics](https://www.youtube.com/watch?v=149TXc_bPeA&t) ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 20 - Sound Sensor Module/SoundSensor/SoundSensor.ino ================================================ /* *********************************************************** * Sound Sensor sketch - v1.1 * Uses the KY-038 module * Uses the U8g2lib.h library * * Inpired by Elegoo Lesson 20, and Arduino Sound meter * by learnelectronics www.youtube.com/c/learnelectronics * * Description: * This sketch illustrates some of the Sound Sensor Module * analog and digital features. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * History: * 01/02/2019 v1.0 - Initial release * 01/05/2019 v1.1 - removed str_len &dtosrtf from drawMeter * function. sprintf function does it all * * @author Ricardo Moreno ********************************************************** */ /* *********************************************************** * Libraries * * ********************************************************* */ #include /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ // OLED Pins // A byte can hold a number up to 255 const PROGMEM int OLED_CLK = 13; // SCK system clock or SCL const PROGMEM int OLED_MOSI = 11; // MOSI or SDA const PROGMEM int OLED_RES = 8; // Reset const PROGMEM int OLED_DC = 7; // Data Communication const PROGMEM int OLED_CS = 6; // Component Select //Instantiate U8G2 object class - Plus Pins //SH1106 U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI oled(U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC, /* reset=*/ OLED_RES); // Other hardware pins const PROGMEM int ledPin = 5; // define LED const PROGMEM int digitalPin = 3; // define Sensor's D0 pin const PROGMEM int analogPin = A0; // define Sensor's A0 pin /* *********************************************************** * Global Constants * * ********************************************************* */ // https://github.com/olikraus/u8g2/wiki/u8g2reference #define largeFont u8g2_font_courB18_tf #define mainFont u8g2_font_courB14_tf const PROGMEM int screenWidth=128; const PROGMEM int screenHeight=64; const char *sketchTitle[] = {"Arduino", "Sound", "Sensor", "Calibrator"}; const int sketchTitleArrayLength = 4; // manually set for above array const int delayTime = 1000; // time in milliseconds /* *********************************************************** * Global Variables * * ********************************************************* */ unsigned long previousMillis = 0; bool ledState = LOW; //To keep track of two different font sizes int largeFont_RowHeight; int mainFont_RowHeight; /* *********************************************************** * Void Setup * * ********************************************************* */ void setup(){ Serial.begin (9600); pinMode(ledPin, OUTPUT); // define LED as output pinMode(digitalPin,INPUT); // define sensor D0 as input //OLED Diplay - Note this is using the full buffer which uses a lot of memory oled.begin(); oled.clear(); oled.setBitmapMode(1); // 1 = object background transparent oled.setDrawColor(1); // set the color //Initialize Fonts sizes // Large Font oled.setFont(largeFont); int Ascent = oled.getAscent(); // getAscent returns the number of pixels above the baseline int Descent = -oled.getDescent(); // getDescent returns a negative value, a number of pixels below the baseline largeFont_RowHeight = Ascent+Descent+1; // Main Font oled.setFont(mainFont); // https://github.com/olikraus/u8g2/wiki/u8g2reference Ascent = oled.getAscent(); // getAscent returns the number of pixels above the baseline Descent = -oled.getDescent(); // getDescent returns a negative value, a number of pixels below the baseline mainFont_RowHeight = Ascent+Descent+1; // Display Title int rowPosition = mainFont_RowHeight-1; // Start from rowPosition 0 for (int x=0; x maxA) { maxA = aValue;} // save new max value volts = (aValue*5.0)/1024.0; minvolts = (minA*5.0)/1024.0; maxvolts = (maxA*5.0)/1024.0; // begin Debug code - Serial print analog value as decimal Serial.print("A = "); Serial.print(aValue,DEC); Serial.print(" Max = "); Serial.print(maxA); Serial.print(" Min = "); Serial.print(minA); Serial.print(" volts = "); Serial.println(volts); // end Debug code drawMeter(volts, minvolts, maxvolts,'V'); } void checkDigital(){ /* checkDigital reads the digital pin and sets LED state if delay time has expired * Parameters: (none) */ bool dValue = HIGH; // variable to store digital value unsigned long currentMillis = millis(); dValue = digitalRead(digitalPin); // digital value from D0 // begin Debug code //if (dValue==LOW) Serial.println("Digital Pin reads LOW"); // end Debug code if(((currentMillis - previousMillis) > delayTime) && (dValue == LOW)){ //if(dValue == LOW){ ledState = !ledState; digitalWrite(ledPin, ledState); previousMillis = currentMillis; } } ================================================ FILE: Lesson 21 - RC522 RFID Module/README.md ================================================ # ElegooTutorial ## Lesson 21 RC522 RFID Module [![YouTube video](https://img.youtube.com/vi/y5X2zwbO6e4/0.jpg)](https://youtu.be/gTQmLkwnUxk) [YouTube video](https://youtu.be/gTQmLkwnUxk) RC522 RFID Module. Demonstrate the Elegoo sketch provided in the tutorial covering the RFID Module and expand the sketch to include a Master and User Tag sketch. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the RC522 RFID Module. Ill step through the Elegoo provided tutorial, briefly explain the code, and build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then expand the sketch to include a Master and User Tag scenario sketch thats inspired by Howtomechatronics. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * RC522 RFID Module * Keychain Tag * Plastic Card Tag * Seven female-to-male jumper wires The next lesson will be Lesson 22: LCD Display ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) Software & Links: * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Tutorial Using DS1307 and DS3231 Real-time Clock Modules with Arduino](https://tronixstuff.com/2014/12/01/tutorial-using-ds1307-and-ds3231-real-time-clock-modules-with-arduino/) * [Arduino Door Lock Access Control Project by HowToMechatronics](https://howtomechatronics.com/tutorials/arduino/rfid-works-make-arduino-based-rfid-door-lock/) * [Interfacing RFID with Arduino How to Read RFID Cards using Arduino](http://www.circuitstoday.com/interfacing-rfid-with-arduino) * [Security Access Using RFID Reader](https://create.arduino.cc/projecthub/Aritro/security-access-using-rfid-reader-f7c746) * [RFID How-To: Not only for Arduino (only legal Stuff!)](https://www.youtube.com/watch?v=vEkfa3OMvec) ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 21 - RC522 RFID Module/RFID_module/RFID_module.ino ================================================ /* *********************************************************** * RFID_module sketch - v1.0 * Uses the RFC522 RFID Module and tags * Uses the SPI.h library * Uses the MFRC522.h library * * Inspired by Elegoo Lesson 21, and by Dejan Nedelkovski * www.HowToMechatronics.com * Arduino Door Lock Access Control Project * https://howtomechatronics.com/tutorials/arduino/rfid-works-make-arduino-based-rfid-door-lock/ * * Description: * This sketch illustrates some of the functionality of the * RFC522 RFID module and tags. Set the card tag as a Master * and use it to authorize the keychain tag. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * History: * 01/20/2019 v1.0 - Initial release * * @author Ricardo Moreno ********************************************************** */ /* *********************************************************** * Libraries * * ********************************************************* */ #include #include /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ /* Typical pin layout used: * ----------------------------------------------------------------------------------------- * MFRC522 Arduino Arduino Arduino Arduino Arduino * Reader/PCD Uno Mega Nano v3 Leonardo/Micro Pro Micro * Signal Pin Pin Pin Pin Pin Pin * ----------------------------------------------------------------------------------------- * RST/Reset RST 9 5 D9 RESET/ICSP-5 RST * SPI SS SDA(SS) 10 53 D10 10 10 * SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16 * SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14 * SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15 */ // Other hardware pins const byte rstPin = 9; // Reset pin const byte ssPin = 10; // Slave Select pin // Instantiate MFRC522 object class MFRC522 rfidReader(ssPin, rstPin); // Other Global Constants const long timeout = 30000; // Timeout in ms /* *********************************************************** * Global Variables * * ********************************************************* */ char* myTags[100] = {}; int tagsCount = 0; String tagID = ""; bool readRFID(long _timeout=timeout, bool useTimeout=false){ /* readRFID will continuously check the RFID reader for the presence of * a tag from and will attempt to get tag IDs. Updates global value * tagID via getTagID function. * Parameters: * _timeout - [optional] the length of time before functio gives up * default value = global timout value * useTimeout - [optional] boolean to enforce timout period or wait * indefinately. Default value = false. * Returns: * true - successfully reads tag ID * false - unsuccessful in reading the tag ID */ bool successRead = false; unsigned long startTime = millis(); unsigned long currentTime = startTime; // S'U'+S'T' // T = (currentTime-startTime) > timeout // T' = (currentTime-startTime) < timeout while (((successRead==false)&&(useTimeout==false)) || ((successRead==false)&&((currentTime - startTime) < _timeout))) { if (isTagPresent() == true){ successRead = getTagID(); } currentTime = millis(); } return successRead; } /* *********************************************************** * Void Setup * * ********************************************************* */ void setup() { // Initiating Serial.begin(9600); // Start the serial monitor SPI.begin(); // Start SPI bus rfidReader.PCD_Init(); // Start MFRC522 object while (!Serial); // Do nothing if no serial port is opened // Obviously this is an over simplified sketch // Master tags would be save in flash storage and // retrieved here. OR a special PIN entered to set // Master Tag. // But for the sake of simplicity, the sketch will // obtain a new master tag when restarted. // Prints the initial message Serial.println(F("-No Master Tag!-")); Serial.println(F(" SCAN NOW")); // readRFID will wait until a master card is scanned if (readRFID() == true) { myTags[tagsCount] = strdup(tagID.c_str()); // Sets the master tag into position 0 in the array Serial.println(F("Master Tag is Set!")); tagsCount++; } printNormalModeMessage(); } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop() { if (isTagPresent()==true){ getTagID(); checkTagID(); } else { delay(50); //return; } } /* *********************************************************** * Functions * * ********************************************************* */ bool isTagPresent(){ /* isTagPresent uses the MFRC522 methods to determine if * a tag is present or the read card serial is enabled. * Parameters: (none) * Returns: * true - if tag detected or read card serial is true * false - no tag detected or no read card serial true */ bool returnValue = true; // NOT a new PICC_IsNewCardPresent in RFID reader //OR // NOT a PICC_ReadCardSerial active in Serial if ( !rfidReader.PICC_IsNewCardPresent() || !rfidReader.PICC_ReadCardSerial() ) { returnValue = false; } return returnValue; } byte checkMyTags(String tagID){ /* checkMyTags function loops through the array of myTags * Parameters: * tagID - a string to look for * Returns: * tagIndex - index in the array of myTags * default 0 */ byte tagIndex = 0; //Serial.println("checkMyTags Started"); // Zero is reserved for master tag for (int i = 1; i < 100; i++) { if (tagID == myTags[i]) { tagIndex = i; } } //Serial.println("checkMyTags ended"); return tagIndex; } void checkTagID(){ /* checkTagID check the tag ID for authorized tag ID values * if Master tag found switch to program mode * Parameters: (none) * Returns: (none) */ // Checks for Master tag if (tagID == myTags[0]) { // Switch to program mode Serial.println(F(" Program mode:")); Serial.println(F(" Add/Remove Tag")); // Now with timeout // readRFID will skip if timeout exceeded if (readRFID(timeout,true)==true) { //Check for authorized tag byte tagIndex = checkMyTags(tagID); if (tagIndex!=0){ //Remove existing tag myTags[tagIndex] = '\0'; Serial.println(F(" Tag Removed!")); } else { //Not existing, add tag myTags[tagsCount] = strdup(tagID.c_str()); Serial.println(F(" Tag Added!")); tagsCount++; } } else { Serial.println(F(" timeout")); } } else { //Check for authorized tag byte tagIndex = checkMyTags(tagID); if (tagIndex!=0){ //Authorized tag Serial.println(F(" Access Granted!")); } else { //Not authorized tag Serial.println(F(" Access Denied!")); Serial.println(F(" New UID & Contents:")); rfidReader.PICC_DumpToSerial(&(rfidReader.uid)); } } printNormalModeMessage(); } bool getTagID() { /* getTagID retrieves the tag ID. Modifies global variable tagID * * Parameters: (none) * Returns: true */ tagID = ""; Serial.print(F(" UID tag: ")); for (byte i = 0; i < rfidReader.uid.size; i++){ // The MIFARE PICCs that we use have 4 byte UID Serial.print(rfidReader.uid.uidByte[i] < 0x10 ? " 0" : " "); Serial.print(rfidReader.uid.uidByte[i], HEX); // Adds the bytes in a single String variable tagID.concat(String(rfidReader.uid.uidByte[i] < 0x10 ? " 0" : " ")); tagID.concat(String(rfidReader.uid.uidByte[i], HEX)); } Serial.println(); Serial.println(); tagID.toUpperCase(); rfidReader.PICC_HaltA(); // Stop reading return true; } void printNormalModeMessage() { /* printNormalModeMessage sends the standard greeting * to the serial monitor. * Parameters: (none) * Returns: (none) */ delay(1500); Serial.println(); Serial.println(F("-Access Control-")); Serial.println(F(" Scan Your Tag!")); } ================================================ FILE: Lesson 22 - LCD Display/HelloWorld/HelloWorld.ino ================================================ /* LiquidCrystal Library - Hello World Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and shows the time. The circuit: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * LCD VSS pin to ground * LCD VCC pin to 5V * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe modified 7 Nov 2016 by Arturo Guadalupi This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld */ // include the library code: #include // I2C library: //#include // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // I2C: use the line below // Parameters: LCD address, number of columns = 16, and the number of rows = 2 //LiquidCrystal lcd(0x3F, 16, 2); void setup() { // Normal begin statement for LCD requiring the number of columns and rows: lcd.begin(16, 2); // Direct wire statement // I2C begin statement: //lcd.begin(); // I2C statement // I2C: Turn on the blacklight //lcd.backlight(); // Print a message to the LCD. lcd.print("hello, world!"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis() / 1000); } ================================================ FILE: Lesson 22 - LCD Display/I2C_check/I2C_check.ino ================================================ // sample code we found on google.com // discovers connected I2C devices // and displayes their address locations #include void setup() { Wire.begin(); Serial.begin(9600); while (!Serial); Serial.println("\nI2C Scanner"); } void loop() { byte error, address; int nDevices; Serial.println("Scanning..."); nDevices = 0; for(address = 1; address < 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.print(address,HEX); Serial.println(" !"); nDevices++; } else if (error==4) { Serial.print("Unknow error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); } } if (nDevices == 0) Serial.println("No I2C devices found\n"); else Serial.println("done\n"); delay(5000); // wait 5 seconds for next scan } ================================================ FILE: Lesson 22 - LCD Display/README.md ================================================ # ElegooTutorial ## Lesson 22 LCD Display [![YouTube video](https://img.youtube.com/vi/x066WTiz9Fw/0.jpg)](https://youtu.be/x066WTiz9Fw) [YouTube video](https://youtu.be/x066WTiz9Fw) 1602A Liquid Crystal Display (LCD) Module. Demonstrate the Elegoo sketch provided in the tutorial covering the LCD Module and simplify the wiring using an I2C LCD adapter module that I purchased separately. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the LCD display, aka, 1602A LCD Module. Ill step through the Elegoo provided tutorial, basically build the tutorials example circuit to demonstrate the functionality. Then Ill add a I2C 1602A adapter module to simplify the wiring show the changes to the sketch to make this happen. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Arduino UNO R3 board * The 1602A LCD module * A 10K potentiometer * 16 male-to-male jumper wires * A 220-ohm resistor * The breadboard The next lesson will be Lesson 23: Thermometer ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) Software & Links: * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Arduino Liquid Crystal Display Tutorial](https://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay) * [Wiring I2C module on 162 LCD with SCL/SDA](https://www.14core.com/wiring-i2c-module-on-16x2-lcd-with-sclsda/) * [How to Set Up and Program an LCD on the Arduino](https://www.youtube.com/watch?v=Mr9FQKcrGpA) * [Arduino LiquidCrystal Library](https://www.arduino.cc/en/Reference/LiquidCrystal) * [fdebrabander/Arduino-LiquidCrystal-I2C-library](https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library) * [OLED Displays with Arduino]( https://www.youtube.com/watch?v=7x1P80X1V3E) - I2C & SPI OLEDs by DroneBot Workshop ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 23 - Thermometer/README.md ================================================ # ElegooTutorial ## Lesson 23 – Thermometer [![YouTube video](https://img.youtube.com/vi/4x23DP97qMM/0.jpg)](https://youtu.be/4x23DP97qMM) [YouTube video](https://youtu.be/4x23DP97qMM) Thermistor MF52 A 103 F 3950. Demonstrate an inspired Elegoo sketch provided in the tutorial covering the Thermistor, using it as a thermometer. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. We’ll need a few things from your Elegoo Arduino UNO kit. I’ll list the items below. In this lesson we’re going to check out an NTC Thermistor, a resistive device that changes with temperature. I’ll step through an Elegoo inspired tutorial, briefly explain the code, and build and configure a simple circuit that is to demonstrate the functionality. I hope you enjoy it. ## Parts you’ll need for the tutorial * Elegoo Uno R3 board * 1602A LCD module * Thermistor * 10K Potentiometer * 10K-ohm resistor * 220-ohm resistor * A bunch of jumper wires. The next lesson will be Lesson 24: Eight LED with 74HC595 ## Links This lesson’s sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line – Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) – amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * [SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background](https://www.amazon.com/gp/product/B071Y6JX3H/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B071Y6JX3H&linkCode=as2&tag=rmorenojr-20&linkId=81e6c312179be2b149bf6eeae0051f14) * [Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008](https://www.amazon.com/gp/product/B01NCOXB2Q/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B01NCOXB2Q&linkCode=as2&tag=rmorenojr-20&linkId=65e4660761a54140f64e954f1770006e) * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * [Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items)](https://www.amazon.com/gp/product/B01CZTLHGE/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B01CZTLHGE&linkCode=as2&tag=rmorenojr-20&linkId=ac3601531bad9439bc32c77b0088b741) * [Elegoo’s web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) Software & Links: * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Steinhart–Hart equation](https://en.wikipedia.org/wiki/Steinhart–Hart_equation) * [Measuring Temperature with an NTC Thermistor](https://www.allaboutcircuits.com/projects/measuring-temperature-with-an-ntc-thermistor/) * [NTC Thermistor Calculating the Temperature Coefficient of a Thermistor](https://www.ametherm.com/thermistor/ntc-thermistor-calculating-the-temperature-coefficient-of-a-thermistor) * [NTC Thermistor Beta](https://www.ametherm.com/thermistor/ntc-thermistor-beta) * [Connecting to a Thermistor](https://learn.adafruit.com/thermistor/using-a-thermistor) * [Tutorial 23: Smoothing Data](https://programmingelectronics.com/tutorial-23-smoothing-data-old-version/) ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 23 - Thermometer/Thermometer/Thermometer.ino ================================================ /* *********************************************************** * Thermometer * uses the LiquidCrystal.h Library * uses LiquidCrystal_I2C.h * * Inspired by Elegoo Lesson 23 and * Measuring Temperature with an NTC Thermistor by all about circuits * https://www.allaboutcircuits.com/projects/measuring-temperature-with-an-ntc-thermistor/ * * The circuit: * 5v ----\/\/\/-------|-------\/\/\/---- GND * R_thermistor | R_2 * | * Analog Pin A0 * * Ardino * UNO: 10K POT 220-ohms * 5V --\/\/\/--- GND 5V --\/\/\/-| * | wiper | * | | * Uno: GND 5V | 12 11 5 4 3 2 | GND * -|---|---|---|---|---|---|---|---|---|---|---|---|---|---| * LCD: VSS VDD V0 RS E D0 D1 D2 D3 D4 D5 D6 D7 A K * * Description: * This sketch illustrates the Thermistor using a smoothing techique * and the LCD. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * History: * 02/24/2019 v1.0 - Initial release * * ********************************************************* */ /* *********************************************************** * Libraries * * ********************************************************* */ #include // Standard LCD library //#include // I2C LCD Library /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ // Standard LCD pin connection const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // instantiate lcd // I2C LCD connection //LiquidCrystal lcd(0x3F, 16, 2); // LCD address, #columns, #rows const int thermistorPin = A0; // Thermistor pin const float Resistor2 = 10000.0; // R2 resistor Value const int SampleNumber = 30; // The number of analog samples (30 max for integer) const int aMax = 1023; // Maximum Analog value 1023 const float t25 = 25.0+273.15; // Temperature in Kelvin at 25C const float r25 = 10000.0; // Thermistor resistance at 25C const float Beta = 3950.0; // Thermistor Beta from the datasheet //Steinhart-Hart Coefficient values - calculated const float scA = 0.00102219653793705; const float scB = 0.000253179116444952; const float scC = -0.000000000058799201163101; /* *********************************************************** * Global Variables * * ********************************************************* */ int aValues[SampleNumber]; // Analog value Array int index = 0; // Tracks the array index int total = 0; // Keeps a running total /* *********************************************************** * Void Setup * * ********************************************************* */ void setup() { /* ********************************** * Normal begin statement for LCD * * (#columns, #rows) * ********************************** */ lcd.begin(16, 2); // Direct wire statement /* ********************************** * I2C begin statements * ********************************** */ //lcd.begin(); // I2C statement //lcd.backlight(); // Turn on the blacklight // Reset or initialize array int aValue = analogRead(thermistorPin); // Get inital analog value seed for(int x=0; x= SampleNumber){index = 0;} // Reset index if >= SampleNumber float Average = float(total) / float(SampleNumber); // Calculate average float rThermistor = Resistor2 * (float(aMax)/Average - 1.0); // Thermistor resistance float tKelvin = 1.0/(scA + scB * log(rThermistor) + scC * (pow(log(rThermistor),3))); float tCelsius = tKelvin - 273.15; // Convert Kelvin to Celsius return(tCelsius); //tKelvin = 1 / (0.001129148 + 0.000234125 * log(rThermistor) + 0.0000000876741 * pow(log(rThermistor),3))); // where A = 0.001129148, B = 0.000234125, and C = 0.0000000876741 // how were these calculated? } void displayTemperature(float tCelsius){ float tFahrenheit = (tCelsius * 9.0)/ 5.0 + 32.0; // Calculate Fahrenheit // Display Temperature in C lcd.setCursor(0, 0); // First row lcd.print("Temp C "); // Updates and clear display row lcd.setCursor(12, 0); // Locate degree symbol lcd.print((char)223); // prints the degree symbol lcd.setCursor(6, 0); // Locate temperature lcd.print(tCelsius); // Display Temperature in F lcd.setCursor(0, 1); // Second Row lcd.print(" F "); // Updates and clear display row lcd.setCursor(12, 1); // Locate degree symbol lcd.print((char)223); // prints the degree symbol lcd.setCursor(6, 1); // Locate temperature lcd.print(tFahrenheit); } ================================================ FILE: Lesson 24 - 74HC595 Shift Register/README.md ================================================ # ElegooTutorial ## Lesson 24 – Eight LED with 74HC595, or 74HC595 shift register [![YouTube video](https://img.youtube.com/vi/ou3WP3Hp5X0/0.jpg)](https://youtu.be/ou3WP3Hp5X0) [YouTube video](https://youtu.be/ou3WP3Hp5X0) Eight LED with 74HC595, or 74HC595 shift register. Demonstrate the tutorial’s sketch and expand the sketch to show back to back shift registers. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. We’ll need a few things from your Elegoo Arduino UNO kit. I’ll list the items below. In this lesson we’re going to check out the 74HC595 shift register, a digital output port expanding device that uses only three Arduino outputs. I’ll step through the Elegoo tutorial, briefly explain the code, and build and configure a simple circuit that is to demonstrate the functionality. Then I’ll expand the circuit with back to back shift registers to control 16 outputs. I hope you enjoy it. ## Parts you’ll need for the tutorial * Elegoo Uno R3 board * 74HC595 shift register IC * 8 LEDS, 2 blue, 2 yellow, 2 red, and 2 green * 8 220-ohm resistors * The breadboard * A bunch of male-to-male jumper wires (about 13 or so). The expanded circuit requires an additional 74HC595 shift register and additional 220-ohm resisters purchased separately. The next lesson will be Lesson 25: The Serial Monitor ## Links This lesson’s sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [74HC595 8-Bit Shift Register with Output Latching, DIP 16, Cascadable (Pack of 10)](https://amzn.to/2O9RFbO) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line – Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) – amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * [Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008](https://www.amazon.com/gp/product/B01NCOXB2Q/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B01NCOXB2Q&linkCode=as2&tag=rmorenojr-20&linkId=65e4660761a54140f64e954f1770006e) * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * [Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items)](https://www.amazon.com/gp/product/B01CZTLHGE/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B01CZTLHGE&linkCode=as2&tag=rmorenojr-20&linkId=ac3601531bad9439bc32c77b0088b741) * [Elegoo’s web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) Software & Links: * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Arduino bitset](https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/) * [Arduino shiftout](https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/) ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 24 - 74HC595 Shift Register/SR_74HC595/SR_74HC595.ino ================================================ /* ********************************************************************** * Shift Register 74HC595 with LEDs * * Inspired by Elegoo Lesson 24 * www.elegoo.com 2016.12.9 * * Circuit: * * LED D12 D11 * 5V 0 MISO GND MOSI D9 5V * | | | | | | | | * |--|----|----|----|----|----|----|----|--| * | VCC Q0 DS OE ST_CP SH_CP MR Q7' | * | | * | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | * |--|----|----|----|----|----|----|----|--| * | | | | | | | | * LED LED LED LED LED LED LED GND * 1 2 3 4 5 6 7 * * https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/ * https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/ ********************************************************************* */ /* *************************************************** * Globsl Constants * *************************************************** */ int tDelay = 100; int dataPin = 12; // DS - data serial on 74HC595 int latchPin = 11; // ST_CP - storage register clock pin on 74HC595 int clockPin = 9; // SH_CP - shift register clock pin on 74HC595 - Why not D13 SCK pin? /* *************************************************** * Globsl Variables * *************************************************** */ bool DirectionState = 0; /* *************************************************** * Functions * *************************************************** */ void updateShiftRegister(byte leds){ digitalWrite(latchPin, LOW); if (DirectionState == false) { shiftOut(dataPin, clockPin, LSBFIRST, leds); } else { shiftOut(dataPin, clockPin, MSBFIRST, leds); } digitalWrite(latchPin, HIGH); } /* *************************************************** * Void Setup * *************************************************** */ void setup(){ pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); } /* *************************************************** * Void Loop * *************************************************** */ void loop(){ byte leds = 0B00000000; updateShiftRegister(leds); delay(tDelay); for (int i = 0; i < 8; i++){ // set the bit i to 1, starting with bit 0, the least significant bit (rightmost bit) bitSet(leds, i); updateShiftRegister(leds); delay(tDelay); } DirectionState = !DirectionState; } ================================================ FILE: Lesson 24 - 74HC595 Shift Register/SR_74HC595_16bit/SR_74HC595_16bit.ino ================================================ /* ********************************************************************** * Shift Register 74HC595 with 16 LEDs * back to back shift registers * * Inspired by Elegoo Lesson 24 * www.elegoo.com 2016.12.9 * * Circuit: * ____________________ * LED D12 D11 | LED | D11 * 5V 0 MISO GND MOSI D9 5V | 5V 8 | GND MOSI D9 5V * | | | | | | | | | | | | | | | | * |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| * | VCC Q0 DS OE ST_CP SH_CP MR Q7' | | VCC Q0 DS OE ST_CP SH_CP MR Q7' | * | | | | * | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | * |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| * | | | | | | | | | | | | | | | | * LED LED LED LED LED LED LED GND LED LED LED LED LED LED LED GND * 1 2 3 4 5 6 7 9 10 11 12 13 14 15 * * https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/ * https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/ ********************************************************************* */ /* *************************************************** * Global Constants * *************************************************** */ const int tDelay = 100; // delay between LED switching const int dataPin = 12; // DS - data serial const int latchPin = 11; // ST_CP - storage register, latch clock pin const int clockPin = 9; // SH_CP - shift register clock pin /* *************************************************** * Global Variables * *************************************************** */ bool DirectionState = 0; /* *************************************************** * Functions * *************************************************** */ void updateShiftRegister(unsigned int leds, bool isMSBFIRST = true){ /* Performs all the necessary work to serial load * two shift registers. Direction controlled by * isMSBFIRST * Paramters: * leds - insigned 16-bit number {required} * isMSBFISRT - boolean for direction * true = MSBFIRST * false = LSBFIRST * called by void loop */ /* Local variables */ /* example: Higher byte Lower byte * 16-bit word = 00000000 00000000 */ byte lowLED = lowByte(leds); // extacts the lower byte, right most byte, from a 16-bit word or unsigned integer byte highLED = highByte(leds); // extracts the higher byte, left most byte, from a 16-bit word or unsigned integer digitalWrite(latchPin, LOW); if (isMSBFIRST == false) { // LEDs move from right to left shiftOut(dataPin, clockPin, LSBFIRST, lowLED); // shiftout only works with a byte value shiftOut(dataPin, clockPin, LSBFIRST, highLED); } else { // LEDs move from left to right shiftOut(dataPin, clockPin, MSBFIRST, highLED); shiftOut(dataPin, clockPin, MSBFIRST, lowLED); } digitalWrite(latchPin, HIGH); } /* *************************************************** * Void Setup * *************************************************** */ void setup(){ pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); } /* *************************************************** * Void Loop * *************************************************** */ void loop(){ unsigned int leds = 0B0000000000000000; updateShiftRegister(leds); delay(tDelay); for (int i = 0; i < 16; i++){ // set the bit i to 1, starting with bit 0, the least significant bit (rightmost bit) leds = 0B0000000000000000; bitSet(leds, i); updateShiftRegister(leds, DirectionState); delay(tDelay); } DirectionState = !DirectionState; } ================================================ FILE: Lesson 24 - 74HC595 Shift Register/SR_74HC595_32bit/SR_74HC595_32bit.ino ================================================ /* ********************************************************************** * Shift Register 74HC595 with 32 LEDs * Four back to back shift registers * * Inspired by Elegoo Lesson 24 * www.elegoo.com 2016.12.9 * * Circuit: * ____________________ ____________________ ____________________ * LED D12 D11 | LED | D11 | LED | D11 | LED | D11 * 5V 0 MISO GND MOSI D9 5V | 5V 8 | GND MOSI D9 5V | 5V 16 | GND MOSI D9 5V | 5V 24 | GND MOSI D9 5V * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| * | VCC Q0 DS OE ST_CP SH_CP MR Q7' | | VCC Q0 DS OE ST_CP SH_CP MR Q7' | | VCC Q0 DS OE ST_CP SH_CP MR Q7' | | VCC Q0 DS OE ST_CP SH_CP MR Q7' | * | | | | | | | | * | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | | Q1 Q2 Q3 Q4 Q5 Q6 Q7 GND | * |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| |--|----|----|----|----|----|----|----|--| * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LED LED LED LED LED LED LED GND LED LED LED LED LED LED LED GND LED LED LED LED LED LED LED GND LED LED LED LED LED LED LED GND * 1 2 3 4 5 6 7 9 10 11 12 13 14 15 17 18 19 20 21 22 23 25 26 27 28 29 30 31 * * https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/ * https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/ ********************************************************************* */ /* *************************************************** * Global Constants * *************************************************** */ const int tDelay = 100; // delay between LED switching const int dataPin = 12; // DS - data serial const int latchPin = 11; // ST_CP - storage register, latch clock pin const int clockPin = 9; // SH_CP - shift register clock pin /* *************************************************** * Global Variables * *************************************************** */ bool DirectionState = 0; /* *************************************************** * Functions * *************************************************** */ void updateShiftRegister(unsigned long leds, bool isMSBFIRST = true){ /* Performs all the necessary work to serial load * two shift registers. Direction controlled by * isMSBFIRST * Paramters: * leds - insigned 16-bit number {required} * isMSBFISRT - boolean for direction * true = MSBFIRST * false = LSBFIRST * called by void loop */ /* Local variables */ unsigned int leds16 = int(leds); unsigned int leds32 = int(leds>>16); /* example: Higher byte Lower byte * 16-bit word = 00000000 00000000 */ byte low16LED = lowByte(leds16); // extacts the lower byte, right most byte, from a 16-bit word or unsigned integer byte high16LED = highByte(leds16); // extracts the higher byte, left most byte, from a 16-bit word or unsigned integer byte low32LED = lowByte(leds32); byte high32LED = highByte(leds32); digitalWrite(latchPin, LOW); if (isMSBFIRST == false) { // LEDs move from right to left shiftOut(dataPin, clockPin, LSBFIRST, low16LED); // shiftout only works with a byte value shiftOut(dataPin, clockPin, LSBFIRST, high16LED); shiftOut(dataPin, clockPin, LSBFIRST, low32LED); // shiftout only works with a byte value shiftOut(dataPin, clockPin, LSBFIRST, high32LED); } else { // LEDs move from left to right shiftOut(dataPin, clockPin, MSBFIRST, high32LED); shiftOut(dataPin, clockPin, MSBFIRST, low32LED); shiftOut(dataPin, clockPin, MSBFIRST, high16LED); shiftOut(dataPin, clockPin, MSBFIRST, low16LED); } digitalWrite(latchPin, HIGH); } /* *************************************************** * Void Setup * *************************************************** */ void setup(){ pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); } /* *************************************************** * Void Loop * *************************************************** */ void loop(){ unsigned long leds = 0B11111111111111111111111111111111; updateShiftRegister(leds); delay(tDelay); leds = 0B00000000000000000000000000000000; updateShiftRegister(leds); delay(tDelay); leds = 0B11111111111111111111111111111111; updateShiftRegister(leds); delay(tDelay); for (int i = 0; i < 32; i++){ // set the bit i to 1, starting with bit 0, the least significant bit (rightmost bit) leds = 0B00000000000000000000000000000000; bitSet(leds, i); updateShiftRegister(leds, DirectionState); delay(tDelay); } DirectionState = !DirectionState; } ================================================ FILE: Lesson 27 - 74HC595 and Segment Display/7-SegmentDisplay/7-SegmentDisplay.ino ================================================ /* ********************************************************************** * 7-SegmentDisplay - v1.0 * Uses Common cathode 7-segment display, * Uses 74HC595 shift register IC * * Inspired by Elegoo Lesson 27 www.elegoo.com * modified by Ricardo Moreno * * Description: * This sketch illustrates the controlling a 7-segment display with * a 74HC595 shift register. * * History: * 5/04/2019 v1.0 - Initial release * * define the LED digit patterns, from 0 - 9 * 1 = LED on, 0 = LED off, common cathode, in this order: * 74HC595 pin Q7,Q6,Q5,Q4,Q3,Q2,Q1,Q0 * Mapping to g,f,e,d,c,dp,a,b of Seven-Segment LED * ********************************************************* */ /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ int latchPin = 11; // connect to the ST_CP of 74HC595 (pin 3,latch pin) int clockPin = 9; // connect to the SH_CP of 74HC595 (pin 4, clock pin) int dataPin = 12; // connect to the DS of 74HC595 (pin 2) byte sevenSegDigits[10] = { B01111011 , // = 0 B00001001 , // = 1 B10110011 , // = 2 B10011011 , // = 3 B11001001 , // = 4 B11011010 , // = 5 B11111000 , // = 6 B00001011 , // = 7 B11111011 , // = 8 B11001011 // = 9 }; byte sevenSegDP = B00000100; // = DP byte sevenSegAlpha[] = { B11101011 , // = A B11111000 , // = b B01110010 , // = C B10111001 , // = d B11110010 , // = E B11100010 , // = F B11011011 , // = g B11101000 , // = h B01100000 // = I }; /* *********************************************************** * Global Variables * * ********************************************************* */ bool bAddDecimalPoint = true; // display state of show decimal point /* *********************************************************** * Void setup * * ********************************************************* */ void setup() { // Set latchPin, clockPin, dataPin as output pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } /* *********************************************************** * Functions * * ********************************************************* */ // display a alpha, binary value, or number on the digital segment display void sevenSegWrite(byte digit, bool bDP = false, char switchValue='D') { /* digit = array pointer or binary value, as a byte * bDP = true-include decimal point, as boolean * switchValue = 'A' alpha * 'B' binary * 'D' digits , as char */ // set the latchPin to low potential, before sending data digitalWrite(latchPin, LOW); // the data (bit pattern) if (switchValue=='A'){ // alpha shiftOut(dataPin, clockPin, MSBFIRST, sevenSegAlpha[digit]+(sevenSegDP*bDP)); } else if (switchValue=='B'){ // binary shiftOut(dataPin, clockPin, MSBFIRST, digit+(sevenSegDP*bDP)); } else { // digits shiftOut(dataPin, clockPin, MSBFIRST, sevenSegDigits[digit]+(sevenSegDP*bDP)); } // set the latchPin to high potential, after sending data digitalWrite(latchPin, HIGH); } void sevenSegBlank(){ // set the latchPin to low potential, before sending data digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, B00000000); // set the latchPin to high potential, after sending data digitalWrite(latchPin, HIGH); } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop() { //Switch add decimal point states bAddDecimalPoint = !bAddDecimalPoint; // count from 9 to 0 // Change byte to int - byte doesn't have a negative number for (int digit = 9; digit >= 0; --digit) { sevenSegWrite(digit, bAddDecimalPoint); delay(1000); } // suspend 1 second sevenSegBlank(); delay(1000); // count from 0 to 9 for (int digit = 0; digit <= 9; digit++) { sevenSegWrite(digit, bAddDecimalPoint); delay(1000); } // suspend 1 second sevenSegBlank(); delay(1000); // alpha characters for (int digit = 0; digit <= 8; digit++){ sevenSegWrite(digit, bAddDecimalPoint, 'A'); delay(1000); } // suspend 1 second sevenSegBlank(); delay(1000); // display individual segments - Binary sevenSegWrite(1,false,'B'); // B00000001 delay(1000); sevenSegWrite(2,false,'B'); // B00000010 delay(1000); sevenSegWrite(4,false,'B'); // B00000100 delay(1000); sevenSegWrite(8,false,'B'); // B00001000 delay(1000); sevenSegWrite(16,false,'B'); // B00010000 delay(1000); sevenSegWrite(32,false,'B'); // B00100000 delay(1000); sevenSegWrite(64,false,'B'); // B01000000 delay(1000); sevenSegWrite(128,false,'B'); // B10000000 delay(1000); // SECRET MESSAGE sevenSegWrite(0xE8,false,'B'); // B11101000 delay(500); sevenSegWrite(0xF2,false,'B'); // B11110010 delay(500); sevenSegWrite(0x70,false,'B'); // B01110000 delay(500); sevenSegBlank(); // small blank flick delay(100); sevenSegWrite(0x70,false,'B'); // B01110000 delay(500); sevenSegWrite(0xB8,false,'B'); // B10111000 delay(500); sevenSegBlank(); delay(500); sevenSegWrite(0xD9,false,'B'); // B11011001 delay(500); sevenSegWrite(0xB8,false,'B'); // B10111000 delay(500); sevenSegWrite(0x38,false,'B'); // B00111000 delay(500); sevenSegWrite(0xF0,false,'B'); // B11110000 delay(500); sevenSegWrite(0x38,false,'B'); // B00111000 delay(500); sevenSegWrite(0xF8,false,'B'); // B11111000 delay(500); sevenSegWrite(0xF2,true,'B'); // B11110010 delay(500); // suspend 1 second sevenSegBlank(); delay(1000); } ================================================ FILE: Lesson 27 - 74HC595 and Segment Display/README.md ================================================ # ElegooTutorial ## Lesson 27 74HC595 and 7-Segment Display [![YouTube video](https://img.youtube.com/vi/gkjsA180xs4/0.jpg)](https://youtu.be/gkjsA180xs4) [YouTube video](https://youtu.be/gkjsA180xs4) 7-Segment Display Module and controlling it with a 74HC595 shift register. Demonstrate a slightly modified 74HC595 and 7-Segment Display Elegoo tutorial sketch and circuit. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the 7-Segment Display Module, and how we can use a 74HC595 shift register to control it using three data connections. Ill step through the Elegoo provided tutorial, briefly explain the code, and build and configure a simple circuit that is provided in the tutorial to demonstrate the functionality. Then will expand the sketch to include an additional functionality. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo Uno R3 board * The 74HC595 shift register IC * 7-segment 1-digit display * Eight 220-ohm resistors * The breadboard * A bunch of male-to-male jumper wires The next lesson will be Lesson 28: Four Digital Seven Segment Display ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [74HC595 8-Bit Shift Register with Output Latching, DIP 16, Cascadable (Pack of 10)](https://amzn.to/2O9RFbO) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) Software & Links: * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Arduino bitset](https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/) * [Arduino shiftout](https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/) ## Affiliate Links that Help my channel: * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 28 - 4 Digit 7 Segment Display/Four_Digit_HexCounter/Four_Digit_HexCounter.ino ================================================ /* ********************************************************************** * Four Digit Hex Counter * Uses: one 74HC595 shift register * one four digit seven segment display - common cathode (5641AS) * four PN2222 transistors * * Inspired by Elegoo Lesson 28 * www.elegoo.com 2016.12.12 * modified by Ricardo Moreno * * Description: * This sketch illustrates controlling a four digit 7-segment * display with a single 74HC595 shift register. Elegoo kit only * has one 74HC595, so the Arduino will control 7-segment pins D1-D4. * * History: * 6/06/2019 v1.0 - Initial release * * Verify circuit connections: * 74HC595 pin Q7,Q6,Q5,Q4,Q3,Q2,Q1,Q0 * Mapping to g, c,DP, d, e, b, f, a (7-Segment LED) * for array purposes D4 = digit0, etc. ********************************************************************* */ /* *************************************************** * Global Constants * *************************************************** */ const int dataPin = 12; // 74HC595 pin 8 DS const int latchPin = 11; // 74HC595 pin 9 STCP const int clockPin = 9; // 74HC595 pin 10 SHCP const int digit0 = 7; // 7-Segment pin D4 const int digit1 = 6; // 7-Segment pin D3 const int digit2 = 5; // 7-Segment pin D2 const int digit3 = 4; // 7-Segment pin D1 /* *************************************************** * Global Variables * *************************************************** */ // Hex values reference which LED segments are turned on // and may vary from circuit to circuit. Note the mapping above. byte table[]= { 0x5F, // = 0 0x44, // = 1 0x9D, // = 2 0xD5, // = 3 0xC6, // = 4 0xD3, // = 5 0xDB, // = 6 0x45, // = 7 0xDF, // = 8 0xC7, // = 9 0xCF, // = A 0xDA, // = b 0x1B, // = C 0xDC, // = d 0x9B, // = E 0x8B, // = F 0x00 // blank }; //Hex shown byte digitDP = 32; // 0x20 - adds this to digit to show decimal point byte controlDigits[] = { digit0, digit1, digit2, digit3 }; // pins to turn off & on digits byte displayDigits[] = { 0,0,0,0,0 }; // ie: { 1, 0, 7, 13, 0} == d701 (all values from table array) /* Each array value holds digit values as table array index, or raw byte * parameters: digit0, digit1, digit2, digit3, digitSwitch * * digitSwitch: the four least significant bits controls data handling, * each bit controls associated digit * starting with least-significant bit 0, * i.e. B1010, digit1 & digit3 are raw, * digit0 & digit2 use table array * 1 = raw byte * 0 = table array index */ unsigned long onTime = 0; // tracks time bool switchView = false; // switch between HexCounter (table array) and RawDisplay (raw bytes) // false = HexCounter // true = RawDisplay unsigned int counter = 0; // RawDisplay counter /* *************************************************** * Global Adjustable Variables * *************************************************** */ int digitDelay = 50; // delay between incrementing digits (ms) int brightness = 90; // valid range of 0-100, 100=brightest unsigned int ShowSegCount = 250; // number of RawDisplay loops before switching again //bool commonCathode = true; /* *************************************************** * Void Setup * *************************************************** */ void setup() { //DDRD=0xff; // make pins 0-7 outputs //DDRB=0xff; // make pins 8-13 outputs //PORTD=0xf0; // make pins 4-7 HIGH pinMode(latchPin,OUTPUT); pinMode(clockPin,OUTPUT); pinMode(dataPin,OUTPUT); for (int x=0; x<4; x++){ pinMode(controlDigits[x],OUTPUT); digitalWrite(controlDigits[x],LOW); // Turns off the digit } } /* *************************************************** * Functions * *************************************************** */ void DisplaySegments(){ /* Display will send out all four digits * one at a time. Elegoo kit only has 1 74HC595, so * the Arduino will control the digits * displayDigits[4] = the right nibble controls output type * 1 = raw, 0 = table array * upper (left) nibble ignored * starting with 0, the least-significant (rightmost) bit */ for (int x=0; x<4; x++){ for (int j=0; j<4; j++){ digitalWrite(controlDigits[j],LOW); // turn off digits } digitalWrite(latchPin,LOW); if (bitRead(displayDigits[4],x)==1){ // raw byte value is sent to shift register shiftOut(dataPin,clockPin,MSBFIRST,displayDigits[x]); } else { // table array value is sent to the shift register shiftOut(dataPin,clockPin,MSBFIRST,table[displayDigits[x]]); } digitalWrite(latchPin,HIGH); digitalWrite(controlDigits[x],HIGH); // turn on one digit delay(1); // 1 or 2 is ok } for (int j=0; j<4; j++){ digitalWrite(controlDigits[j],LOW); // turn off digits } } void HexCounter(){ /* Increments values stored in displayDigits array to * creates a Hex counter from the table array. * Uses mixed display types: * Digit3 | Digit2 | Digit1 | Digit0 * --------------------------------- * C | 0 | 0 | 0 */ byte Letter = B00011011; // C //increment values for digits 0-2 bool incrementValue = true; for (int d = 0; d < 3; d++){ int x = int(displayDigits[d]); if (incrementValue == true) { x++; incrementValue = false; if (x > 15) { displayDigits[d] = 0; incrementValue = true; } else { displayDigits[d] = byte(x); } } } // Set digit3 value displayDigits[3] = Letter; // Set digitSwitch option displayDigits[4] = B1000; if ((displayDigits[0] == 0)&&(displayDigits[1] == 0)&&(displayDigits[2] == 0)){ switchView = !switchView; for(int x = 0; x < 5; x++){ displayDigits[x]=0; } // Reset array displayDigits[4] = B0000; } } void RawDisplay(){ // HALO displayDigits[0] = B01011111; // 0 displayDigits[1] = B00011010; // L displayDigits[2] = B11001111; // A displayDigits[3] = B11001110; // H // Set digitSwitch option displayDigits[4] = B1111; if (counter < ShowSegCount){ counter++; } else { // Reset everything counter = 0; switchView = !switchView; for(int x =0; x<5; x++){ displayDigits[x]=0; } // Reset array displayDigits[4] = B0000; } } /* *************************************************** * Void Loop * *************************************************** */ void loop() { DisplaySegments(); // Caution: Avoid extra delays /* ************************************* * Control Brightness * * *********************************** */ delayMicroseconds(1638*((100-brightness)/10)); // largest value 16383 /* ************************************* * Selects Display Type * * *********************************** */ unsigned long nowValue = millis() - onTime; if (nowValue >= long(digitDelay)){ onTime = millis(); if(switchView==true){ RawDisplay(); } else { HexCounter(); } } } ================================================ FILE: Lesson 28 - 4 Digit 7 Segment Display/README.md ================================================ # ElegooTutorial ## Lesson 28 4 Digit 7 Segment Display [![YouTube video](https://img.youtube.com/vi/gesrM2J8VnY/0.jpg)](https://youtu.be/gesrM2J8VnY) [YouTube video](https://youtu.be/gesrM2J8VnY) Four Digit Seven Segment Display Module. Demonstrate the Elegoo sketch provided in the tutorial covering the display module, show it shortcomings and provide a revised sketch to properly control a 4-digit 7-segment display with 74HC595 shift register IC and four PN2222 transistors. A beginner's guide to the Most Complete Starter Kit by Elegoo. Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. Well need a few things from your Elegoo Arduino UNO kit. Ill list the items below. In this lesson were going to check out the 4 Digit 7 Segment Display Module, 5641AS common cathode type. Ill step through the Elegoo provided tutorial, briefly explain the code, the circuit, and some of the issues. Then I present my revised circuit and sketch that properly demonstrates the functionality. I hope you enjoy it. ## Parts youll need for the tutorial * Elegoo UNO R3 board * The 74HC595 shift register IC * 4-digit, 7-segment display * Four 220-ohm resistors * The breadboard * A bunch of male-to-male jumper wires ## To build the revised circuit, add the following: * Four 220-ohm resistors * Four 5K-ohm resistors * Four PN2222 transistors The next lesson will be Lesson 29: DC Motors ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) Various Parts can be found: * [74HC595 8-Bit Shift Register with Output Latching, DIP 16, Cascadable (Pack of 10)](https://amzn.to/2O9RFbO) * [MAX7219 LED Dot Matrix Module 8 x 8 with 5pcs Dupont Line Amazon](https://www.amazon.com/gp/product/B07775NFS1/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325) * [DHT21 AM2301 Capacitive Digital Temperature and Humidity Sensor](https://www.amazon.com/AM2301-Capacitive-Digital-Temperature-Humidity/dp/B07543HBQ2) amazon * [SODIAL(R) DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/SODIAL-Digital-Temperature-Humidity-Raspberry/dp/B0757FBWSB/ref=sr_1_19?s=industrial&ie=UTF8&qid=1520801854&sr=1-19&keywords=dht22) * [DHT22 AM2302 Digital Temperature and Humidity Sensor Module](https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Raspberry/dp/B01N6PB489/ref=sr_1_4?s=industrial&ie=UTF8&qid=1520801995&sr=1-4&keywords=dht22) - amazon * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * [Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon](https://amzn.to/2z6sCCw) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) Software & Links: * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [Arduino bitset](https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/) * [Arduino shiftout](https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/) * [How to use a common anode 7-segment, 4-digit display?](https://arduino.stackexchange.com/questions/21608/how-to-use-a-common-anode-7-segment-4-digit-display) ## Affiliate Links that Help my channel: * [Logitech M510 Wireless Mouse on Amazon](https://amzn.to/2z4FF7F) * Try Prime Discounted Monthly Offering: https://amzn.to/2PnVgSA * Try Amazon Prime 30-Day Free Trial: https://amzn.to/2E5Hy4O * Prime Student 6-month Trial: https://amzn.to/2ElxwNE * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: https://amzn.to/2PsEZvE * Give the Gift of Amazon Prime https://amzn.to/2EkFaYG * Kindle Unlimited Membership Plans: https://amzn.to/2QJl548 * Try Audible and Get Two Free Audiobooks: https://amzn.to/2QD2B5v * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: https://amzn.to/2Ptpdkl * Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](http://www.hooksounds.com) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 29 - DC Motors/DC_Motor/DC_Motor.ino ================================================ /* ********************************************************************** * DC_Motor * Uses: one DC Motor * one L293D Quadruple half H-Bridge driver IC * one Breadboard Power Supply, MB-102 * * Inspired by Elegoo Lesson 29 * www.elegoo.com 2016.12.12 * modified by Ricardo Moreno * * Description: * This sketch illustrates controlling a DC Motor using an * L293D Quadruple half H-Bridge driver IC. Note that the "D" * indicates inductive transient suppression diodes are * integrated in the IC. It's recommended that a separate * power supply is is used. * * Circuit: L293D * _______ * Arduino 5---EN12-| |-VCC1---5V * Ardunio 4-----1A-| |-4A * DCMotor+-----1Y-| |-4Y * GND--------| |--------GND * GND--------| |--------GND * DCMotor- ----2Y-| |-3Y * Arduino 3-----2A-| |-3A * 4.5-36V---VCC2-| |-EN34 * ------- * History: * 6/16/2019 v1.0 - Initial release * 7/01/2019 v1.1 - Additional comments, minor rev to void loop * ********************************************************************* */ /* *************************************************** * Global Constants * *************************************************** */ const int Enable12 = 5; // PWM pin to L293D's EN12 (pin 1) const int Driver1A = 4; // To L293D's 1A (pin 2) const int Driver2A = 3; // To L293D's 2A (pin 7) /* *************************************************** * Global Variables * *************************************************** */ //none /* *************************************************** * Global Adjustable Variables * *************************************************** */ //none /* *************************************************** * Void Setup * *************************************************** */ void setup(){ //---set pin direction pinMode(Enable12,OUTPUT); pinMode(Driver1A,OUTPUT); pinMode(Driver2A,OUTPUT); Serial.begin(9600); } /* *************************************************** * Functions * *************************************************** */ void motorCTRL(byte speed, bool D1A, bool D2A){ /* motorCTRL controls the DC motor * speed: any value between 0-255, used as PWM * 0 - off * 255 - maximum * D1A: Input 1 or 1A, boolean value of HIGH or LOW * D2A: Input 2 or 2A, boolean value of HIGH or LOW */ analogWrite(Enable12,speed); // PWM digitalWrite(Driver1A,D1A); // Boolean digitalWrite(Driver2A,D2A); // Boolean } /* *************************************************** * Void Loop * *************************************************** */ void loop() { Serial.println("One way, then reverse"); //---back and forth example for (int i=0;i<5;i++){ motorCTRL(255,HIGH,LOW); // one way delay(500); motorCTRL(255,LOW,HIGH); // reverse delay(500); } motorCTRL(0,LOW,HIGH); // Stop delay(2000); Serial.println("fast Slow example"); //---fast/slow stop example motorCTRL(255,HIGH,LOW); // one way delay(3000); motorCTRL(0,HIGH,LOW); // slow stop delay(2000); motorCTRL(255,LOW,HIGH); // reverse delay(3000); motorCTRL(255,LOW,LOW); // fast stop delay(2000); Serial.println("PWM full then slow"); //---PWM example, full speed then slow for(int x = 255; x >= 55; x -= 25){ motorCTRL(x,HIGH,LOW); delay(1000); } motorCTRL(0,HIGH,LOW); // Stop delay(2000); Serial.println("PWM slow then full"); //---PWM example, slow then full speed for(int x = 55; x <= 255; x += 25){ motorCTRL(x,HIGH,LOW); delay(1000); } motorCTRL(0,HIGH,LOW); // Stop delay(10000); } ================================================ FILE: Lesson 4 - RGB LED/README.md ================================================ # ElegooTutorial ## Lesson 4 - RGB LED [Youtube Video](https://youtu.be/uNO4HSl6Ldw) A beginner's guide to the Most Complete Starter Kit by Elegoo. Lesson 4 – RGB LED Hello everyone, I'm Rick the Tech Enthusiast again, with the next Lesson number 4 “RGB LED”. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. Now, I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I recently purchased this Arduino UNO R3 kit by Elegoo. I’m pronouncing it El-E-Goo, I hope that’s right. No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. In this video, we’ll need a few things from your Elegoo Arduino kit. I’ll list the items below. In this lesson we’re going to learn how to change the colors of the RGB LED with the Arduino using PWM (pulse width modulation). I step through the Elegoo code to explain how it makes this happen. Then I expand on the idea with a revised sketch. The new sketch has three different methods of making colors with the RGB LED. The first method was inspired by HowToMechatronic.com. By using a function call we greatly simplify the code and make everything more readable. Next, I rewrite the three “for loops” that was included in the original code. And third, I create a single “do loop” or “do while loop” to cycle through all the colors in a single loop. Best of all, I’ve added Serial.begin and Serial.print statements to view and diagnose the code in the Serial Monitor. I hope you like the Lesson, it was a lot of fun to make. ## Parts you’ll need * Arduino UNO R3 board * RGB LED (the only LED in the kit with four leads) * Three 220 ohm resistors * Four male-to-male wire jumpers * Breadboard I should also mention that ** Paul McWhorter ** has a great [programming series for the Arduino UNO](https://www.youtube.com/watch?v=d8_xXNcGYgo&list=PLGs0VKk2DiYx6CMdOQR_hmJ2NbB4mZQn-). You should check it out. The next lesson will be Lesson 5 – Digital Inputs ## Links * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoo’s web site](https://www.elegoo.com/) * [Elegoo's Complete Starter Kit](https://www.amazon.com/gp/product/B01CZTLHGE/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B01CZTLHGE&linkCode=as2&tag=rmorenojr-20&linkId=ac3601531bad9439bc32c77b0088b741) - [web site](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Frtizing Software](http://fritzing.org/download/) * [Arduino Language Reference](https://www.arduino.cc/reference/en/) * [LESSON 13: Controlling an RGB LED with Arduino](https://www.youtube.com/watch?v=gqAHOoqo3OI) – by Paul McWhorter * [HowToMechantronics](http://howtomechatronics.com/tutorials/arduino/how-to-use-a-rgb-led-with-arduino/) * Music provided by Free Music Archive, by artist [Jahzzar](http://freemusicarchive.org/search/?sort=track_date_published&d=1&quicksearch=jahzzar) This is the fifth video on a new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 4 - RGB LED/RGB_LED/RGB_LED.ino ================================================ /* *********************************************************** * RGB_LED sketch - v1.0 * Uses common cathode RGB LED * Arduino UNO R3 * * Inspired by Elegoo Lesoon 4 - RGB LED * Included with The Most Complete Starter Kit by Elegoo * Original by - HowToMechatronics.com and Elegoo.com * Modified by - Ricardo Moreno * * Description: * This sketch illustrates a few ways to control the RGB LED * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * History: * 1/5/2018 - v1.0 initial release * 12/30/2019 - Minor comment and indent revisions to * improve readability. Moved Function setColor * to the top of the sketch. Renamed delayTime * to longDelay. * * ********************************************************* */ /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ /* The Arduino Web site recommends that one uses const * rather than #define since using #define could have * unwanted side effects */ const int redPin = 6; // Red LED pin const int greenPin = 5; // Green LED pin const int bluePin = 3; // Blue LED pin const int maxBright = 255; // Maximum LED brightness /* *********************************************************** * Functions * * ********************************************************* */ void setColor(int redValue, int greenValue, int blueValue){ analogWrite(redPin, redValue); analogWrite(greenPin, greenValue); analogWrite(bluePin, blueValue); Serial.print("Red: "); Serial.print(redValue); Serial.print(" Green: "); Serial.print(greenValue); Serial.print(" Blue: "); Serial.println(blueValue); } /* *********************************************************** * Void Setup * * ********************************************************* */ void setup(){ Serial.begin(9600); //Turn On the Serial Port pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); } /* *********************************************************** * Void Loop * * ********************************************************* */ void loop(){ //Local Variables int longDelay = 1000; // fading time between colors int shortDelay = 10; // short time delay between colors int redValue; int greenValue; int blueValue; int ledGear; // For switching LED fading //I combined various ways to turn on the RGB LED //Here we manually set the color Serial.println("Manual Colors"); setColor(maxBright, 0, 0); //Red Color delay(longDelay); setColor(0, maxBright, 0); //Green Color delay(longDelay); setColor(maxBright, maxBright, maxBright); //White Color delay(longDelay); setColor(170, 0, maxBright); //Purple Color delay(longDelay); Serial.println("Fade from Red to Green"); //Fade from Red to Green delay(longDelay); redValue = maxBright; greenValue = 0; blueValue = 0; for(int i = 0; i < maxBright+1; i++){ setColor(redValue, greenValue, blueValue); redValue -= 1; greenValue += 1; delay(shortDelay); } Serial.println("Fade from Green to Blue"); //Fade from Green to Blue delay(longDelay); redValue = 0; greenValue = maxBright; blueValue = 0; for(int i = 0; i < maxBright+1; i++){ setColor(redValue, greenValue, blueValue); greenValue -= 1; blueValue += 1; delay(shortDelay); } Serial.println("Fade from Blue to Red"); //Fade from Blue to Red delay(longDelay); redValue = 0; greenValue = 0; blueValue = maxBright; for(int i = 0; i < maxBright+1; i++){ setColor(redValue, greenValue, blueValue); blueValue -= 1; redValue += 1; delay(shortDelay); } Serial.println("Fade All three colors Red to Green, Green to Blue, Blue to Red"); //Fade All three colors Red to Green, Green to Blue, Blue to Red delay(longDelay); redValue = maxBright; greenValue = 0; blueValue = 0; ledGear = 1; do { setColor(redValue, greenValue, blueValue); //First Gear - Fade from Red to Green if (ledGear == 1) { redValue -= 1; greenValue += 1; } //Second Gear - Fade from Green to Blue if (ledGear == 2){ greenValue -= 1; blueValue += 1; } //Third Gear - Fade from Blue to Red if (ledGear == 3){ blueValue -= 1; redValue +=1; } //Gear Switching if (greenValue == maxBright) ledGear = 2; if (blueValue == maxBright) ledGear = 3; if (redValue == maxBright+1) ledGear = 4; delay(shortDelay); } while (ledGear < 4); delay(longDelay); } ================================================ FILE: Lesson 5 - Digital Inputs/DigitalInput_Debounce/DigitalInput_Debounce.ino ================================================ /* The Most Complete Starter Kit by Elegoo * For the Arduino UNO R3 * LESSON 5 - Digital Input(s) * Single button with debounce function * * Original by - Applied Electronics, lynda.com, and Elegoo.com * Modified by - Ricardo Moreno * Date 1/9/2018 * * Originally, the Lesson 5 sketch used two push button switches * to operate the LED. This sketch allows for a single push button * switch. * * Serial Monitor added for diagnostic purposes. * * Applied Electronics * https://www.youtube.com/watch?v=QslLAPNSEFc */ //usefull video to watch from educ8s.tv //https://www.youtube.com/watch?v=jYOYgU2vlSE // Global Variables const int ledPin = 5; const int buttonPin = 2; boolean lastButton = HIGH; //HIGH is the not pressed state boolean currentButton = HIGH; //HIGH is the not pressed state boolean ledOn = false; int counter = 0; // Sketch Setup routine - run once void setup(){ Serial.begin(9600); //starts the serial monitor and sets the baud rate pinMode(ledPin, OUTPUT); //sets the digital pin to output pinMode(buttonPin, INPUT_PULLUP); //define pinMode and use Pull-up resistor serialOut(ledOn,counter); //write the initial state of the LED } // main loop - runs repeatedly void loop(){ //Get button value or state currentButton = debounce(lastButton); //Recall that whenever you release the button, the state goes HIGH //When you press the button, you are forcing the state LOW if(lastButton == LOW && currentButton == HIGH){ //Button press detected counter += 1; //increment the counter ledOn = !ledOn; //shorthand way to switch to the opposite setting digitalWrite(ledPin, ledOn); //Turn ON or OFF the LED serialOut(ledOn,counter); //write the state of the LED and number of time the button has been pushed } lastButton = currentButton; } //Debouncing function boolean debounce(boolean last){ //Local Variable boolean current = digitalRead(buttonPin); if(last != current){ delay(5); //5 milliseconds current = digitalRead(buttonPin); } return current; } //Serial Output function void serialOut(boolean ledState, int i){ Serial.print("LED is "); if (ledState) Serial.print("ON - button pressed "); if (!ledState) Serial.print("OFF - button pressed "); Serial.print(i); Serial.println(" times"); } ================================================ FILE: Lesson 5 - Digital Inputs/DigitalInput_DeepSleep/DigitalInput_DeepSleep.ino ================================================ /* The Most Complete Starter Kit by Elegoo * For the Arduino UNO R3 * LESSON 5 - Digital Input(s) * Using Interrupt, Low Power, Deep Sleep * * Original by - Kevin Darrah * Modified by - Ricardo Moreno * Date 1/10/2018 * * Originally, the Lesson 5 sketch used two push button switches * to operate the LED. This sketch uses a single push button * switch activating an interrupt, waking up the Arduino. It runs the * code inside the void loop and automatically goes into a deep sleep. * It also has a watchdog timer to to automatically wake the circuit * every 8 seconds. * * Kevin Darrah does a great job flipping bits without the need for an * external library. He does an awesome job explaining this deep sleep setup. * * Serial Monitor added for diagnostic purposes. * * Kevin Darrah - Low Power Arduino! Deep Sleep Tutorial * https://www.youtube.com/watch?v=urLSDi7SD8M&t */ //Page of interest //https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/ // Global Variables const int ledPin = 5; const int buttonPin = 2; //Arduino UNO requires pins 2 or 3 volatile int counter = 0; // Sketch Setup routine - run once void setup(){ Serial.begin(9600); //starts the serial monitor and sets the baud rate pinMode(buttonPin, INPUT_PULLUP); //define pinMode and use Pull-up resistor //Save Power by writing all Digital IO pins to LOW // Of course be carefull not to include pins you are using // not skipping LED pin is OK for (int i = 0; i < 20; i++) { if(i != buttonPin){ //we're using pin 2 for the button pinMode(i, OUTPUT); digitalWrite(i, LOW); } } //pinMode(ledPin, OUTPUT); //sets the digital pin to output - handled by above for loop /* attachInterrupt syntax * * attachInterrupt(interrupt, ISR, mode) * * interrupt can be either 0 or 1 for interrupts on pins 2 or 3. * recommend using the following code * digitalPinToInterrupt(pin) * * ISR Interrupt Service Routine - Name of a function * you want to execute after interrupt above * * mode� When the interrupt should be triggered. Options: * LOW a low level trigger * CHANGE a change in level trigger * RISING a rising edge of a level trigger * FALLING a falling edge of a level trigger * */ attachInterrupt(digitalPinToInterrupt(buttonPin), buttonInterrupt, RISING); serialOut(false, counter); //write the initial state of the LED /*SETUP WATCHDOG TIMER * This is set for about 8 seconds * See manufacturer's data sheet for other options * WDTCSR = * bits 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 * WDIF | WDIE | WDP3 | WDCE | WDE | WDP2 | WDP1 | WDP0 * * To enable and set the watchdog timer we must * set WDCE and WDE bits but * Also clears/resets prescaler bits WDP3,WDP2,WDP1,WDP0 * See Watchdog Timer Control Register for more info * 24 = 00011000 */ WDTCSR = (24); /* The above line must be followed by * Setting the prescalers bits WDP3,WDP2,WDP1,WDP0. * This gives us the 8 seconds based on table in data sheet. * We must also clear WDE and WDCE bits * 33 = 00100001 */ WDTCSR = (33); // Now enable interrupt mode with new settings - set WDIE bit WDTCSR |= (1 << 6); //uses compound bitwise OR operator shift register trick /*Disable Analog to Digital Converter (ADC) * ADCSRA - ADC Control and Status Register A * Set the ADEN bit to 0 to turn off ADC * don't forget to flip back after waking up if using ADC * in your application ADCSRA |= (1 << 7); */ ADCSRA &= ~(1 << 7); //uses compound bitwise AND operator and inverted shift register trick /*ENABLE SLEEP MODE - * Sleep Mode Control Register * SMCR = * bits 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 * - | - | - | - | SM2 | SM1 | SM0 | SE * bits 7-4 are unused * SE - Sleep Enable bit * * Sleep Mode Table * SM2 | SM1 | SM0 | Sleep Mode * 0 0 0 Idle * 0 0 1 ADC noise reduction * 0 1 0 Power-down * 0 1 1 Power-save * 1 1 0 Standby + * 1 1 1 External Standby + * + only recommended with external crystals or resonators * See manufacturer's data sheet for other options * * Using a technique to shift register bits * this enables the sleep mode * be sure to have an interrupt enabled or the * watchdog timer to wake it up */ //SET the sleep mode bit(s) SMCR |= (1 << 2); //power down mode SMCR |= 1; //enable sleep mode } // main loop - runs repeatedly void loop(){ Serial.println("Void loop starts"); digitalWrite(ledPin, HIGH); serialOut(true, counter); /* Put all you running code here * Once it's complete it will go * back to sleep. */ delay(1000); //delay not required digitalWrite(ledPin, LOW); serialOut(false, counter); goToSleep(); Serial.println("Void loop ends"); } void buttonInterrupt() { counter++; //increment the counter Serial.println("Button is pressed"); //This returns to the goToSleep or void loop } //Serial Output function void serialOut(boolean ledState, int i){ Serial.print("LED is "); if (ledState) Serial.print("ON - button pressed "); if (!ledState) Serial.print("OFF - button pressed "); Serial.print(i); Serial.println(" times"); } void goToSleep() { Serial.println("going to sleep"); delay(60); //small delay is necessary otherwise it goes to sleep before serial.println is done /*Disable the Brownout Detect circuit while sleeping * * this must be called right before the __asm__ sleep instruction * MCUCR - MCU Control Register * bits 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 * - | BODS | BODSE | PUD | - | - | IVSEL | IVCE * * Set Both BODS and BODSE at the same time * 3 = 11 */ MCUCR |= (3 << 5); //then set the BODS bit and clear the BODSE bit within 4 clock cycles //The trick below clears BODSE and sets BODS to 1 MCUCR = (MCUCR & ~(1 << 5)) | (1 << 6); __asm__ __volatile__("sleep"); //in line assembler to go to sleep Serial.println("waking up"); } // watchdog interrupt ISR(WDT_vect){ Serial.println("Watch dog is on duty"); //DON'T FORGET THIS! Needed for the watch dog timer. // This is called after a watch dog timer timeout - // this is the interrupt function called after waking up } ================================================ FILE: Lesson 5 - Digital Inputs/README.md ================================================ # ElegooTutorial ## Lesson 5 – Digital Inputs A beginner's guide to the Most Complete Starter Kit by Elegoo. **Lesson 5 – Digital Inputs** [YouTube Video](https://www.youtube.com/watch?v=rbeHQ80dux8) Hello everyone, I'm Rick the Tech Enthusiast again, with the next Lesson number 5 “Digital Inputs”. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. I’m pronouncing it El-E-Goo, I hope that’s right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, we’ll need a few things from your Elegoo Arduino kit. I’ll list the items below. In this lesson we’re going to learn how to include digital inputs to your circuit using a couple of pushbutton switches. I step through the Elegoo provided code to explain how it makes this happen. Then, like before, I expand on the idea with a revised sketch. I wanted to provide a sketch that only uses a single button to turn on and off the LED. I also introduce the idea of debouncing the button input and how to handle it with code. And there more. I include yet another sketch, and this time it’s a circuit that turns on, and automatically goes to sleep when done. The watchdog timer is included to periodically wake the board. And a manual method in included to wake the circuit using a button and assigning to an Arduino interrupt. All while trying to achieve a very low power, deep sleep, mode. I got some great ideas from Kevin Darrah and Lynda.com Of course, I’ve added Serial.begin and Serial.print statements to view and diagnose the code in the Serial Monitor. I hope you like the Lesson, it was a lot of fun to make. ## Parts you’ll need for the basic tutorial * Arduino UNO R3 board * 5mm LED * 220 ohm resistor * Two pushbutton switches * Seven male-to-male wire jumpers * And the breadboard I should also mention that **Kevin Darrah** has a great [YouTube video](https://www.youtube.com/watch?v=urLSDi7SD8M) for the low power, deep sleep mode for the Arduino UNO. You should check it out. The next lesson will be Lesson 6 – Active Buzzer ## Links This lesson’s sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoo’s web site](https://www.elegoo.com/) * [Elegoo's Complete Starter Kit](https://www.amazon.com/gp/product/B01CZTLHGE/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B01CZTLHGE&linkCode=as2&tag=rmorenojr-20&linkId=ac3601531bad9439bc32c77b0088b741) - [web site](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Frtizing Software](http://fritzing.org/download/) * [Arduino Language Reference](https://www.arduino.cc/reference/en/) * [attachinterrupt](https//www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/) * [Applied Electronics](https://www.youtube.com/watch?v=QslLAPNSEFc) – **Lynda.com** * [educ8s.tv](https://www.youtube.com/watch?v=jYOYgU2vlSE) * [Kevin Darrah - Low Power Arduino! Deep Sleep Tutorial](https://www.youtube.com/watch?v=urLSDi7SD8M) This is the sixth video on a new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 6 - Active Buzzer/MorseCode_Translator/MorseCode_Translater/MorseCode_Translater.ino ================================================ /* *********************************************************** * Morse Code Translater * By Ricardo Moreno Jr. * created 01/15/2018 * * Inspired by learnelectronics * https://www.youtube.com/watch?v=3WjNiJOcVaM * Nick B * https://pastebin.com/SM9jmjdG * * From Wikipedia * length of a dot is 1 unit * length of a dash is 3 units * length of a space between parts of the same letter is 1 unit * length of a space between letters is 3 units * length of a space between words is seven units * * The Dot or Dash are commonly referred to as Dit or Dah * * History: * 1/15/2018 v1.0 - Initial release * 11/29/2020 V1.1 - Revised comments and indenting for readability. * Added detect Line Feed character in doString function * - thx peterlution * *********************************************************** */ /* *********************************************************** * Global Constants * * Hardware Definitions * * ********************************************************* */ const int buzzerPin = 12; // set buzzer pin const int ledPin = 6; // set LED pin /* *********************************************************** * Global Variables * * ********************************************************* */ String strInput = ""; // Morse Code Specific delays int mcUnit = 75; // length of time in milliseconds // mcUnit is the only value that // needs adjusting int dit = mcUnit; // dit equals 1 unit of time int dah = 3 * mcUnit; // dah equals 3 units of time int partsDelay = mcUnit; // 1 unit between parts int letterDelay = 3 * mcUnit; // 3 units between letters int wordDelay = 7 * mcUnit; // 7 units between words /* *********************************************************** * Global Arrays * * ********************************************************* */ // Recall Arrays start from 0 String letters[] = { ".-", "-...", "-.-.", "-..", // A-D ".", "..-.", "--.", "....", // E-H "..", ".---", "-.-", ".-..", // I-L "--", "-.", "---", ".--.", // M-P "--.-", ".-.", "...", "-", // Q-T "..-", "...-", ".--", "-..-", // U-X "-.--", "--.." // Y-Z }; String numbers[] = { "-----", ".----", "..---", // 0-2 "...--", "....-", ".....", // 3-5 "-....", "--...", "---..", // 6-8 "----." // 9 }; String Lpunctuation[] = { "-.-.--", // ! -33 ".-..-.", // " -34 "X", // # -35 "...-..-", // $ -36 "X", // % -37 ".-...", // & -38 ".----.", // ' -39 "-.--.", // ( -40 "-.--.-", // ) -41 "X", // * -42 ".-.-.", // + -43 "X", // , -44 "-....-", // - -45 ".-.-.-", // . -46 "-..-.", // / -47 }; String Upunctuation[] = { "---...", // : -58 "-.-.-.", // ; -59 "X", // < -60 "-...-", // = -61 "X", // > -62 "..--..", // ? -63 ".--.-." // @ -64 }; String SpecialCase[] = { "_", "..--.-", // _ -95 }; // Not included yet String ProSigns[] = { "...-.-", // End Of Work "........", // Error "-.-", // Invitation to Transmit - K "-.-.-", // Starting Signal ".-.-.", // New Page Signal - + "...-.", // Understood - also Ŝ ".-..." // Wait - also & }; /* *********************************************************** * Void setup * * ********************************************************* */ void setup() { // setup code here, runs once Serial.begin(9600); // Used for Serial Monitor pinMode(buzzerPin, OUTPUT); // set buzzer pin, OUTPUT automatically sets it to LOW pinMode(ledPin, OUTPUT); // set LED pin, OUTPUT automatically sets it to LOW } /* *********************************************************** * Functions * * ********************************************************* */ void DitOrDah(int DitOrDahDelay){ /* This function turns ON and OFF the LED * and Active Buzzer by the delay value * passed to it. */ digitalWrite(buzzerPin, HIGH); digitalWrite(ledPin, HIGH); delay(DitOrDahDelay); // dit or dah delay digitalWrite(buzzerPin, LOW); digitalWrite(ledPin, LOW); } void doSequence(String sequence){ // Local Variables int strLen = 0; char chValue = ""; strLen = sequence.length(); // get length of string //note: last char is a NULL for (int x = 0; x < strLen; x++){ // loop through all parts chValue = sequence.charAt(x); // get char value if(chValue == '.'){ DitOrDah(dit); // do a Dit Serial.print("."); // print dit } else if (chValue == '-'){ DitOrDah(dah); // do a Dah Serial.print("-"); // print dah } else if (chValue == 'X'){ // No translation Serial.print("X - no translation"); // print no translation } else if (int(chValue) == 0){ // Null char in string // Null found // May not be needed // Do Nothing // should be skipped } // end if statement if (x < strLen) delay(partsDelay); // gap between parts } // end for Serial.println(""); } // end doSequence void translate(char ch){ /* Recall that letters have a numeric ASCII value * so you can add and substract them * a = 97 * A = 65 * 0 = 48 * * Modify this function for additonal character checks * ASCII numerical order below (mostly) */ if (ch >= '!' && ch <= '/'){ Serial.print(ch); Serial.print(" "); doSequence(Lpunctuation[ch - '!']); } else if (ch >= '0' && ch <= '9'){ Serial.print(ch); Serial.print(" "); doSequence(numbers[ch - '0']); } else if (ch >= ':' && ch <= '@'){ Serial.print(ch); Serial.print(" "); doSequence(Upunctuation[ch - ':']); } else if (ch >= 'A' && ch <= 'Z'){ Serial.print(ch); Serial.print(" "); doSequence(letters[ch - 'A']); } else if (ch >= 'a' && ch <= 'z'){ Serial.print(ch); Serial.print(" "); doSequence(letters[ch - 'a']); } else if (ch == '_'){ Serial.print(ch); Serial.print(" "); doSequence(SpecialCase[1]); } else { Serial.println("invalid character"); // Skip invalid character } // end if statement } // end translate void doString(String strValue){ // Local Variables char chValue; int strLen = 0; strLen = strValue.length(); // get the length of the string for(int x = 0; x <= strLen; x++){ // loop through string to get each value chValue = strInput.charAt(x); // get char at position x if (chValue == " " || int(chValue) == 32){// Found Space between words Serial.println("(space)"); delay(wordDelay); // delay between words } else if (int(chValue) == 13){ // Carrige Return found // Do Nothing } else if (int(chValue) == 10){ // Line feed found // Do Nothing } else if (int(chValue) == 0){ // Null found // Do Nothing } else { translate(chValue); // translate character to Morse Code if (x < strLen) delay(letterDelay); // delay between letters } // end if } // end for } // end doString /* *********************************************************** * Void Loop * * ********************************************************* */ void loop(){ // main code here, runs repeatedly Serial.println("Enter a string you want to translate to Morse Code"); // Use the Serial Monitor to input a message while (Serial.available() == 0){ // Do Nothing // Wait until user input } strInput = Serial.readString(); // get the new String Serial.print(" Translating => "); Serial.println(strInput); // print string to serial monitor doString(strInput); // go to doString function delay(1000); // delay between loops Serial.println(""); // Add a new line feed to serial monitor strInput=""; // clear the string } ================================================ FILE: Lesson 6 - Active Buzzer/README.md ================================================ # ElegooTutorial ## Lesson 6 – Active Buzzer and Morse Code Translator [YouTube Video](https://youtu.be/RKejZWnCWx8) A beginner's guide to the Most Complete Starter Kit by Elegoo. **Lesson 6 – Active Buzzer** Hello everyone, I'm Rick the Tech Enthusiast again, with the next Lesson number 6 “Active Buzzer”. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. I’m pronouncing it El-E-Goo, I hope that’s right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, we’ll need a few things from your Elegoo Arduino kit. I’ll list the items below. In this lesson we’re going to learn what an active buzzer is and how to use them in our projects. I step through the Elegoo provided code to explain how it makes this happen. The pulsating tone makes a great pet scaring circuit. And as I was just about to finish the video, I got this idea on making a Morse Code Translator circuit. The Morse Code Translator circuit used the active buzzer, LED, couple of resistors and a few jumpers to the Arduino. The code is a little more advanced, so I’ve included some additional links below that covers some of the topics. Now, I have to admit that I use my phone to record all the live video shots, and I have to sync them up in my editor. Which is Movie Maker for Windows (cue the sad trombone). It was a challenge to mesh the screen capture and live capture together. But I assure you that the code works. I like to thank learnelectronics and Nick B for inspiring me to create the Morse Code Sketch. And the Programming Electronics Academy has a great video “An easy way to make noise with Arduino using tone()”, which may apply more towards the next lesson but he has a fantastic piezo buzzer explanation. Of course, I’ve added Serial.begin, Serial.print, and Serial.read statements to view and diagnose the code in the Serial Monitor. I hope you like the Lesson, it was a lot of fun to make. ## Parts you’ll need for the basic tutorial * Arduino UNO R3 board * Active Buzzer (that the one with a white sticker on it) * Two female-to-male wire jumpers The next lesson will be **Lesson 7 – Passive Buzzer** ## Links This lesson’s sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoo’s web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [attachinterrupt](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/) * [Arduino ASCII chart](https://www.arduino.cc/en/Reference/ASCIIchart) * [Morse Code - Wikipedia.org](https://en.wikipedia.org/wiki/Morse_code) * [Arduino Morse Code Translator](https://www.youtube.com/watch?v=3WjNiJOcVaM) - by learnelectronics * [Arduino Morse Code Translator](https://pastebin.com/SM9jmjdG) - Nick B * Great piezo buzzer explanation - [An easy way to make noise with Arduino using tone()](https://www.youtube.com/watch?v=1_LMAgO14z0&t) - Programming Electronics Academy * [LESSON 12: Simple and Easy Way to Read Strings Floats and Ints over Arduino Serial Port](https://www.youtube.com/watch?v=VIa_QZWIonQ) - Paul McWhorter * Music provided by Free Music Archive, by artist **Jahzzar** - [Jahzzar_-_07_-_maniac](http://freemusicarchive.org/music/Jahzzar/) This is the seventh video on a new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 7 - Passive Buzzer/HappyBirthday/HappyBirthday.ino ================================================ /* Happy Birthday Melody On Arduino UNO With 3-way Polyphony * Modified by Ricardo Moreno Jr. * https://github.com/rmorenojr/ElegooTutorial * 01/21/2018 * * Original for the Arduion Nano - by Liss * https://www.hackster.io/liss/happy-birthday-melody-on-arduino-nano-with-3-way-polyphony-c80c31 * * * * For use with newer Tone-Master by bhagman * https://github.com/bhagman/Tone * * Tone.h Library * Properties * No properties. * Methods * begin(pin) - prepares a pin for playing a tone. * isPlaying() - returns true if tone is playing, false if not. * play(frequency[,duration]) - play a tone. * - frequency is in Hertz, and the duration is in milliseconds. * - duration is optional. If duration is not given, tone will * play continuously until stop() is called. * - play() is non-blocking. Once called, play() will return * immediately. If duration is given, the tone will play for * that amount of time, and then stop automatically. * stop() - stop playing a tone. * */ #include //Each Tone calss object uses an internal timer Tone solo; // Plays the standard Happy Birthday music Tone bass; // Plays the low pitch past switching music Tone rythm; // Plays the high pitches fast switching music //Note: with 3 timers used with above Tone class objects - //the delay() function will no longer work. //Global Constants // Timing const int t4 = 600; // quarter note duration in ms const int t2 = t4*2; // half note const int td2 = t4*3; // dotted half note const int wt = t4*4; // whole note const int t16 = round(t4*1/4); // 1/16 note const int t8 = round(t4*1/2); // 1/8 note const int td8 = round(t4*3/4); // dotted 1/8 note const int ts8 = round(t8*.8); // Stacatto 1/8 note //Pin Assignments // Avoid Pins 0 & 1, since they are also used by the serial port const int bassLedPin = 14; // bass led signal pin (aka A0) const int rythmLedPin = 17; // rythm led signal pin (aka A3) const int soloLedPin = 19; // solo led signal pin (aka A5) const int bassBuzzerPin = 12; // bass buzzer signal pin const int rythmBuzzerPin = 6; // rythm buzzer signal pin const int soloBuzzerPin = 2; // solo buzzer signal pin boolean bassLedState = LOW; boolean rythmLedState = LOW; boolean soloLedState = LOW; int Sonic = 20000; //The high frequency for the delay void setup(void){ /* ******* Ground Pins Setup ******** * If your circuit constraints require that you * accomidate ground pins elsewhere, changing the * pin to OUTPUT will create the LOW to complete * the circuit. */ //pinMode(15, OUTPUT); // led ground pin (aka A1) //pinMode(16, OUTPUT); // led ground pin (aka A2) //pinMode(18, OUTPUT); // led ground pin (aka A4) //pinMode(2, OUTPUT); // solo buzzer ground pin //pinMode(9, OUTPUT); // rythm buzzer ground pin //LED pins setup pinMode(bassLedPin, OUTPUT); // bass led signal pin pinMode(rythmLedPin, OUTPUT); // rythm led signal pin pinMode(soloLedPin, OUTPUT); // solo led signal pin //Buzzer pins setup solo.begin(soloBuzzerPin); // solo buzzer signal pin bass.begin(bassBuzzerPin); // bass buzzer signal pin rythm.begin(rythmBuzzerPin); // rythm buzzer signal pin } void loop(void){ //Happy Birthday Music Score solo.play(NOTE_D4, td8); switchSoloLed(); wait(solo); solo.play(NOTE_D4, t16); switchSoloLed(); wait(solo); bass.play(NOTE_G3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_E4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_B3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_D4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_D4, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_G4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_D4, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); solo.play(NOTE_FS4, t2); switchSoloLed(); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_FS4, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_A4, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); solo.play(NOTE_D4, td8); switchSoloLed(); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); solo.play(NOTE_D4, t16); switchSoloLed(); wait(rythm); bass.play(NOTE_D4, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); solo.play(NOTE_E4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_FS4, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); solo.play(NOTE_D4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_A4, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); solo.play(NOTE_A4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_G3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_G4, t2); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_B3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_D4, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_D4, td8); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); solo.play(NOTE_D4, t16); switchSoloLed(); wait(rythm); bass.play(NOTE_G3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_D5, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_B3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_B4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_D4, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_G4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_C4, t4); switchBassLed(); rythm.play(NOTE_C5, t8); switchRythmLed(); solo.play(NOTE_FS4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_E5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_G5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_E4, t4); switchBassLed(); rythm.play(NOTE_C5, t8); switchRythmLed(); solo.play(NOTE_E4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_E5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_G5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_G4, t4); switchBassLed(); rythm.play(NOTE_C5, t8); switchRythmLed(); solo.play(NOTE_C5, td8); switchSoloLed(); wait(rythm); rythm.play(NOTE_E5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_G5, t16); switchRythmLed(); solo.play(NOTE_C5, t16); switchSoloLed(); wait(rythm); bass.play(NOTE_G3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_B4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_D3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_G4, t4); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_FS3, t4); switchBassLed(); rythm.play(NOTE_D5, t8); switchRythmLed(); solo.play(NOTE_A4, t4); switchSoloLed(); wait(rythm); wait(rythm); rythm.play(NOTE_FS5, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_A5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_G3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); solo.play(NOTE_G4, t2); switchSoloLed(); wait(rythm); rythm.play(NOTE_B4, t16); switchRythmLed(); wait(rythm); rythm.play(NOTE_D5, t16); switchRythmLed(); wait(rythm); bass.play(NOTE_B3, t4); switchBassLed(); rythm.play(NOTE_G4, t8); switchRythmLed(); wait(rythm); //Turn off rythm LED rythmLedState = HIGH; switchRythmLed(); //rythm.play(NOTE_B4, t16); switchRythmLed(); //wait(rythm); //rythm.play(NOTE_D5, t16); switchRythmLed(); //wait(rythm); wait(bass); //Turn off bass LED bassLedState = HIGH; switchBassLed(); wait(solo); //Turn off solo LEDs soloLedState = HIGH; switchSoloLed(); //small pause before continuing //can't use delay with three timers in use solo.play(Sonic,ts8); wait(solo); } /* *********************************************************** * Functions * *********************************************************** */ void wait(Tone t){ while (t.isPlaying()) { } } void switchBassLed(){ bassLedState = !bassLedState; digitalWrite(bassLedPin, bassLedState); } void switchRythmLed(){ rythmLedState = !rythmLedState; digitalWrite(rythmLedPin, rythmLedState); } void switchSoloLed(){ soloLedState = !soloLedState; digitalWrite(soloLedPin, soloLedState); } ================================================ FILE: Lesson 7 - Passive Buzzer/README.md ================================================ # ElegooTutorial ## Lesson 7 – Passive Buzzer and Happy Birthday, Imperial March, and Super Mario melody player with 3-Way Polyphony [YouTube video](https://youtu.be/X-3AoN8Subk) A beginner's guide to the Most Complete Starter Kit by Elegoo. **Lesson 7 – Passive Buzzer** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 7 “Passive Buzzer”. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. I’m pronouncing it El-E-Goo, I hope that’s right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, we’ll need a few things from your Elegoo Arduino kit. I’ll list the items below. In this lesson we’re going to learn what a passive buzzer is and how to use them in our projects. I step through the Elegoo provided code to explain how it makes this happen. I also ran into some problems with what was recommended from piezo manufacturers, and other web sites, with what’s provided in the tutorial. So I explain my findings, and restart the tutorial. I even revise the provided sketch to include a scale that plays up and down. For bonus material, I created a music player inspired by the Happy Birthday Melody for the Nano with 3-way Polyphony by Liss. I use the prototype board and mini breadboard that’s included in the kit. I did have to purchase additional passive buzzers to make this work (links below). I quickly take you through the changes in the code and play the Happy Birthday melody in 3-Way Polyphony. I repeated this for the Star Wars Imperial March (not Polyphony), and Super Mario theme melodies. Sorry, I did ramble a few times. But overall, I had a blast and maybe I’ll revisit the project in the future. I hope you like the Lesson, it was a lot of fun to make. ## Parts you’ll need for the basic tutorial * Arduino UNO R3 board * Passive Buzzer (that the one without a white sticker on it – you’ll need two more if you want to do the bonus sketch) * One diode (5 are provided in the kit) * One 100-ohm resistor * Several jumpers * Breadboard ## The Bonus Music Player parts * Arduino UNO R3 board * Three passive buzzers (links are provided below) * Three 100-ohm resistors * Three 1N4007 diode * 5mm Red LED * 5mm Yellow LED * 5mm Green LED * Three 220-ohm resistors * Various jumper wires * Mini breadboard * Elegoo prototype board The next lesson will be **Lesson 8 – Tilt Ball Switch and the Magic 8-Ball** ## Links This lesson’s sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoo’s web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [attachinterrupt](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/) * [Arduino tone() function](https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/) * [Arduino Playing tones on Multiple outputs using the tone() function](https://www.arduino.cc/en/Tutorial/ToneMultiple) * [Tone.h library](https://github.com/bhagman/Tone) * [An easy way to make noise with Arduino using tone()](https://www.youtube.com/watch?v=1_LMAgO14z0&t) - by Programming Electronics Academy * Great piezo buzzer explanation [An easy way to make noise with Arduino using tone()](https://www.youtube.com/watch?v=1_LMAgO14z0&t) - Programming Electronics Academy * [Happy Birthday Melody on Arduino Nano With 3-way Polyphony](https://www.hackster.io/liss/happy-birthday-melody-on-arduino-nano-with-3-way-polyphony-c80c31) by Liss * [Arduino + Star Wars Imperial March (Buzzer/Piezo)](https://www.youtube.com/watch?v=83xHpj3PstI) by Profe-Electro * [Super Mario Bros. Overworld Theme (old version)](https://pastebin.com/AKR5VL87) by Ignacio Castillo Álvarez * [Overworld / Main Theme](http://www.mariopiano.com/midi-sound-file-overworld-main-theme.html) by mariopiano.com * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_12_-_Birthday_Cake](http://freemusicarchive.org/music/Jahzzar/) This is another video for my new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 7 - Passive Buzzer/StarWarsImperialMarch/StarWarsImperialMarch.ino ================================================ /* Arduino + Star Wars Imperial March (Buzzer/Piezo) * Modified by Ricardo Moreno * https://github.com/rmorenojr/ElegooTutorial * 01/21/2018 * * Original by Profe-Electro * https://www.youtube.com/watch?v=83xHpj3PstI */ #include //Global Constants const int melodyBuzzerPin = 6; // Digital Pin 8 const int leftLedPin = 19; // Analog Pin A5 const int rightLedPin = 17; // Analog Pin A3 /* I couldn't figure out the timing of this score * perhaps I'll revise it in the future * Imperial March * Ala Marcia 1/4 note = 112 on sheet music * https://www.youtube.com/watch?v=4pwcsn0TU0Q */ // Timing const int t4 = 125; // quarter note duration in ms const int td4 = t4*1.5; // dotted quarter note const int tL4 = t4*1.3; // Legato quarter note const int t2 = t4*2; // half note const int td2 = t4*3; // dotted half note const int tL2 = t2*1.3; // Legato half note const int wt = t4*4; // whole note const int wtL = wt*1.3; // whole note const int t16 = round(t4*1/4); // 1/16 note const int t8 = round(t4*1/2); // 1/8 note const int tL8 = round(t8*1.3); // Legato 1/8 note const int td8 = round(t8*1.5); // dotted 1/8 note const int ts8 = round(t8*.8); // Stacatto 1/8 note boolean FlipFlop = true; // LED state void setup(){ //Setup pin modes pinMode(melodyBuzzerPin, OUTPUT); pinMode(leftLedPin, OUTPUT); pinMode(rightLedPin, OUTPUT); } void loop(){ //Play first section firstSection(); //Play second section secondSection(); //Variant 1 beep(NOTE_F4, t2); beep(NOTE_GS4, wt); beep(NOTE_F4, tL2); beep(NOTE_A4, t4); beep(NOTE_C5, wt); beep(NOTE_A4, td2); beep(NOTE_C5, t4); beep(NOTE_E5, wtL); delay(wt); //Repeat second section secondSection(); //Variant 2 beep(NOTE_F4, t2); beep(NOTE_GS4, wt); beep(NOTE_F4, td2); beep(NOTE_C5, t4); beep(NOTE_A4, wt); beep(NOTE_F4, td2); beep(NOTE_C5, t4); beep(NOTE_A4, wtL); delay(wtL); } /* *********************************************************** * Functions * *********************************************************** */ void beep(int note, int duration){ //Play tone on melodyBuzzerPin tone(melodyBuzzerPin, note, duration); if(FlipFlop){ digitalWrite(leftLedPin, HIGH); } else { digitalWrite(rightLedPin, HIGH); } delay(duration); digitalWrite(leftLedPin, LOW); digitalWrite(rightLedPin, LOW); FlipFlop = !FlipFlop; //Stop tone on melodyBuzzerPin noTone(melodyBuzzerPin); delay(ts8); } void firstSection(){ beep(NOTE_A4, wt); beep(NOTE_A4, wt); beep(NOTE_A4, wt); beep(NOTE_F4, tL2); beep(NOTE_C5, tL4); beep(NOTE_A4, wt); beep(NOTE_F4, tL2); beep(NOTE_C5, tL4); beep(NOTE_A4, wtL); delay(wt); beep(NOTE_E5, wt); beep(NOTE_E5, wt); beep(NOTE_E5, wt); beep(NOTE_F5, tL2); beep(NOTE_C5, tL4); beep(NOTE_GS4, wt); beep(NOTE_F4, tL2); beep(NOTE_C5, tL4); beep(NOTE_A4, wtL); delay(wt); } void secondSection(){ beep(NOTE_A5, wt); beep(NOTE_A4, tL2); beep(NOTE_A4, tL4); beep(NOTE_A5, wt); beep(NOTE_GS5, tL2); beep(NOTE_G5, td4); beep(NOTE_FS5, t4); beep(NOTE_F5, t4); beep(NOTE_FS5, t2); delay(tL2); beep(NOTE_AS4, t2); beep(NOTE_DS5, wt); beep(NOTE_D5, tL2); beep(NOTE_CS5, td4); beep(NOTE_C5, t4); beep(NOTE_B4, t4); beep(NOTE_C5, t2); delay(tL2); } ================================================ FILE: Lesson 7 - Passive Buzzer/SuperMario/SuperMario.ino ================================================ /* Super Mario Bros. Overworld Theme with 3-way Polyphony * Modified by Ricardo Moreno * https://github.com/rmorenojr/ElegooTutorial * 1/26/2018 * * Original: * Arduino Music! Super Mario Bros. Overworld Theme (old version) * Ignacio Castillo Álvarez * https://pastebin.com/AKR5VL87 * * Tone.h Library * Properties * No properties. * Methods * begin(pin) - prepares a pin for playing a tone. * isPlaying() - returns true if tone is playing, false if not. * play(frequency[,duration]) - play a tone. * - frequency is in Hertz, and the duration is in milliseconds. * - duration is optional. If duration is not given, tone will * play continuously until stop() is called. * - play() is non-blocking. Once called, play() will return * immediately. If duration is given, the tone will play for * that amount of time, and then stop automatically. * stop() - stop playing a tone. * * Constants: Musical Notes * Constant Name Frequency (Hz) Constant Name Frequency (Hz) * NOTE_B0 31 NOTE_C5 523 * NOTE_C1 33 NOTE_CS5 554 * NOTE_CS1 35 NOTE_D5 587 * NOTE_D1 37 NOTE_DS5 622 * NOTE_DS1 39 NOTE_E5 659 * NOTE_E1 41 NOTE_F5 698 * NOTE_F1 44 NOTE_FS5 740 * NOTE_FS1 46 NOTE_G5 784 * NOTE_G1 49 NOTE_GS5 831 * NOTE_GS1 52 NOTE_A5 880 * NOTE_A1 55 NOTE_AS5 932 * NOTE_AS1 58 NOTE_B5 988 * NOTE_B1 62 NOTE_C6 1047 * NOTE_C2 65 NOTE_CS6 1109 * NOTE_CS2 69 NOTE_D6 1175 * NOTE_D2 73 NOTE_DS6 1245 * NOTE_DS2 78 NOTE_E6 1319 * NOTE_E2 82 NOTE_F6 1397 * NOTE_F2 87 NOTE_FS6 1480 * NOTE_FS2 93 NOTE_G6 1568 * NOTE_G2 98 NOTE_GS6 1661 * NOTE_GS2 104 NOTE_A6 1760 * NOTE_A2 110 NOTE_AS6 1865 * NOTE_AS2 117 NOTE_B6 1976 * NOTE_B2 123 NOTE_C7 2093 * NOTE_C3 131 NOTE_CS7 2217 * NOTE_CS3 139 NOTE_D7 2349 * NOTE_D3 147 NOTE_DS7 2489 * NOTE_DS3 156 NOTE_E7 2637 * NOTE_E3 165 NOTE_F7 2794 * NOTE_F3 175 NOTE_FS7 2960 * NOTE_FS3 185 NOTE_G7 3136 * NOTE_G3 196 NOTE_GS7 3322 * NOTE_GS3 208 NOTE_A7 3520 * NOTE_A3 220 NOTE_AS7 3729 * NOTE_AS3 233 NOTE_B7 3951 * NOTE_B3 247 NOTE_C8 4186 * NOTE_C4 262 NOTE_CS8 4435 * NOTE_CS4 277 NOTE_D8 4699 * NOTE_D4 294 NOTE_DS8 4978 * NOTE_DS4 311 * NOTE_E4 330 * NOTE_F4 349 * NOTE_FS4 370 * NOTE_G4 392 * NOTE_GS4 415 * NOTE_A4 440 * NOTE_AS4 466 * NOTE_B4 494 */ #include //Note Atmega328 can only have three Tone objects at a time Tone left; Tone right; Tone center; // If you instantiate 3 Tone classes, the delay function is disabled and it will crash your Arduino, // it just freezes - nothing permantent //Global Constants // Timing // quarter note duration = 100 beats per minute const int t = 75; const int tt = t*2; //150 const int ttt = t*3; //225 const int tv = t*5; //375 const int tvii = t*7; //525 /* **************************************************** * I was going to attempt the figure out a better timing * scheme. Hasn't been implemented yet. */ //Whole note = 4 beats //half note = 2 beats //quarter note = 1 beat //eighth note = 1/3 beat //sixteenth note = 1/4 beat //a doted not adds and aditional 1/2 length of note // so a doted quarter note = 1.5 beats //Stacatto play note shorter //Sheet music half note = 200 with 2/2 time signature const int tq = 100; //quarter note duration const int t14 = round(tq*1/4); // 1/16 note const int t24 = round(tq*2/4); // 1/8 note const int t34 = round(tq*3/4); // dotted 1/8 note const int t2s = round(tq*3/2); // Stacatto half note //Pin Assignments // Avoid Pins 0 & 1, since they are also used by the serial port const int ledLeftPin = 14; //Also known as A0 const int ledCenterPin = 17; //Also known as A3 const int ledRightPin = 19; //Also known as A5 const int leftBuzzer = 12; const int centerBuzzer = 6; const int rightBuzzer = 2; int Sonic = 20000; void setup(){ left.begin(leftBuzzer); right.begin(rightBuzzer); center.begin(centerBuzzer); pinMode(ledLeftPin, OUTPUT); pinMode(ledCenterPin, OUTPUT); pinMode(ledRightPin, OUTPUT); } void loop(){ mario0(); mario1(); mario2(); mario1(); mario2(); mario3(); mario4(); mario3(); mario5(); mario3(); mario4(); mario3(); mario5(); mario6(); mario7(); mario6(); mario0(); mario1(); mario2(); mario1(); mario2(); mario8(); mario9(); mario8(); marioa(); mario8(); mario9(); mario8(); marioa(); mario6(); mario7(); mario6(); mario0(); mario8(); mario9(); mario8(); marioa(); //Infinite Loop while(1); } /* *********************************************************** * Functions * *********************************************************** */ void wait(Tone t){ while (t.isPlaying()) { } } void silence(int delayValue){ left.play(Sonic,delayValue); wait(left); } void soundThree(int note1, int note2, int note3, int tempo){ digitalWrite(ledLeftPin, HIGH); left.play(note1, tempo); right.play(note2, tempo); center.play(note3, tempo); //delay(tempo); wait(center); left.stop(); right.stop(); digitalWrite(ledLeftPin, LOW); } void soundTwo(int note1, int note2, int tempo){ digitalWrite(ledCenterPin, HIGH); //int bigdelay = tempo - 4; left.play(note1, tempo); right.play(note2, tempo); wait(right); //delay(bigdelay); digitalWrite(ledCenterPin, LOW); } void soundsOne(int note1, int tempo){ digitalWrite(ledRightPin, HIGH); //int bigdelay = tempo + 1; left.play(note1, tempo); //delay(bigdelay); wait(left); digitalWrite(ledRightPin, LOW); } void mario0(){ soundThree(NOTE_FS3,NOTE_E4,NOTE_D3,t); silence(t); soundThree(NOTE_FS3,NOTE_E4,NOTE_D3,t); silence(ttt); soundThree(NOTE_FS3,NOTE_E4,NOTE_D3,t); silence(ttt); soundThree(NOTE_FS3,NOTE_C4,NOTE_D3,t); silence(t); soundThree(NOTE_FS3,NOTE_E4,NOTE_D3,t); silence(ttt); soundThree(NOTE_B3,NOTE_G4,NOTE_F4,t); silence(tvii); soundTwo(NOTE_G3,NOTE_G3,t); silence(tvii); } void mario1(){ soundThree(NOTE_E3,NOTE_C4,NOTE_G3,t); silence(tv); soundThree(NOTE_C3,NOTE_G3,NOTE_E3,t); silence(tv); soundThree(NOTE_G2,NOTE_E3,NOTE_C3,t); silence(tv); soundThree(NOTE_C3,NOTE_A3,NOTE_F3,t); silence(ttt); soundThree(NOTE_D3,NOTE_B3,NOTE_G3,t); silence(ttt); soundThree(NOTE_CS3,NOTE_AS3,NOTE_FS3,t); silence(t); soundThree(NOTE_C3,NOTE_A3,NOTE_F3,t); silence(ttt); } void mario2(){ soundThree(NOTE_C3,NOTE_G3,NOTE_E3,t); silence(tt); soundThree(NOTE_G3,NOTE_E4,NOTE_C4,t); silence(tt); soundThree(NOTE_B3,NOTE_G4,NOTE_E4,t); silence(tt); soundThree(NOTE_C4,NOTE_A4,NOTE_F4,t); silence(ttt); soundThree(NOTE_A3,NOTE_F4,NOTE_D4,t); silence(t); soundThree(NOTE_B3,NOTE_G4,NOTE_E4,t); silence(ttt); soundThree(NOTE_A3,NOTE_E4,NOTE_C4,t); silence(ttt); soundThree(NOTE_E3,NOTE_C4,NOTE_A3,t); silence(t); soundThree(NOTE_F3,NOTE_D4,NOTE_B3,t); silence(t); soundThree(NOTE_D3,NOTE_B3,NOTE_G3,t); silence(tv); } void mario3(){ soundsOne(NOTE_C3,t); silence(t); soundTwo(NOTE_E4,NOTE_G4,t); silence(t); soundThree(NOTE_DS4,NOTE_FS4,NOTE_G3,t); silence(t); soundTwo(NOTE_D4,NOTE_F4,t); silence(t); soundTwo(NOTE_B3,NOTE_DS4,t); silence(t); soundsOne(NOTE_C4,t); silence(t); soundTwo(NOTE_C4,NOTE_E4,t); silence(t); soundsOne(NOTE_F3,t); silence(t); soundTwo(NOTE_E3,NOTE_GS3,t); silence(t); soundTwo(NOTE_F3,NOTE_A3,t); silence(t); soundThree(NOTE_G3,NOTE_C4,NOTE_C4,t); silence(t); soundsOne(NOTE_C4,t); silence(t); soundTwo(NOTE_C3,NOTE_A3,t); silence(t); soundThree(NOTE_E3,NOTE_C4,NOTE_F3,t); silence(t); soundTwo(NOTE_F3,NOTE_D4,t); silence(t); } void mario4(){ soundsOne(NOTE_C3,t); silence(ttt); soundTwo(NOTE_E4,NOTE_G4,t); silence(t); soundThree(NOTE_DS4,NOTE_FS4,NOTE_E3,t); silence(t); soundTwo(NOTE_D4,NOTE_F4,t); silence(t); soundTwo(NOTE_B3,NOTE_DS4,t); silence(t); soundsOne(NOTE_G3,t); silence(t); soundThree(NOTE_C4,NOTE_E4,NOTE_C4,t); silence(ttt); soundThree(NOTE_F4,NOTE_C5,NOTE_G5,t); silence(ttt); soundThree(NOTE_F4,NOTE_C5,NOTE_G5,t); silence(t); soundThree(NOTE_F4,NOTE_C5,NOTE_G5,t); silence(ttt); soundsOne(NOTE_G3,t); silence(ttt); } void mario5(){ soundsOne(NOTE_C3,t); silence(ttt); soundThree(NOTE_GS3,NOTE_DS4,NOTE_GS3,t); silence(tv); soundThree(NOTE_F3,NOTE_D4,NOTE_B3,t); silence(tv); soundThree(NOTE_E3,NOTE_C4,NOTE_C4,t); silence(tv); soundsOne(NOTE_G3,t); silence(t); soundsOne(NOTE_G3,t); silence(ttt); soundsOne(NOTE_C3,t); silence(ttt); } void mario6(){ soundThree(NOTE_GS3,NOTE_C4,NOTE_GS2,t); silence(t); soundTwo(NOTE_GS3,NOTE_C4,t); silence(ttt); soundThree(NOTE_GS3,NOTE_C4,NOTE_DS3,t); silence(ttt); soundTwo(NOTE_GS3,NOTE_C4,t); silence(t); soundThree(NOTE_AS3,NOTE_D4,NOTE_GS3,t); silence(ttt); soundThree(NOTE_G3,NOTE_E4,NOTE_G3,t); silence(t); soundTwo(NOTE_E3,NOTE_C4,t); silence(ttt); soundThree(NOTE_E3,NOTE_A3,NOTE_C3,t); silence(t); soundTwo(NOTE_C3,NOTE_G3,t); silence(ttt); soundsOne(NOTE_G2,t); silence(ttt); } void mario7(){ soundThree(NOTE_GS3,NOTE_C4,NOTE_GS2,t); silence(t); soundTwo(NOTE_GS3,NOTE_C4,t); silence(ttt); soundThree(NOTE_GS3,NOTE_C4,NOTE_DS3,t); silence(ttt); soundTwo(NOTE_GS3,NOTE_C4,t); silence(t); soundThree(NOTE_AS3,NOTE_D4,NOTE_GS3,t); silence(t); soundTwo(NOTE_G3,NOTE_E4,t); silence(t); soundsOne(NOTE_G3,t); silence(tv); soundsOne(NOTE_C3,t); silence(tv); soundsOne(NOTE_G2,t); silence(ttt); } void mario8(){ soundThree(NOTE_C4,NOTE_E4,NOTE_C3,t); silence(t); soundTwo(NOTE_A3,NOTE_C4,t); silence(ttt); soundThree(NOTE_E3,NOTE_G3,NOTE_FS3,t); silence(t); soundsOne(NOTE_G3,t); silence(ttt); soundThree(NOTE_E3,NOTE_GS3,NOTE_C4,t); silence(ttt); soundThree(NOTE_F3,NOTE_A3,NOTE_F3,t); silence(t); soundTwo(NOTE_C4,NOTE_F4,t); silence(t); soundsOne(NOTE_F3,t); silence(t); soundTwo(NOTE_C4,NOTE_F4,t); silence(t); soundThree(NOTE_F3,NOTE_A3,NOTE_C4,t); silence(t); soundsOne(NOTE_C4,t); silence(t); soundsOne(NOTE_F3,t); silence(ttt); } void mario9(){ soundThree(NOTE_G3,NOTE_B3,NOTE_D3,t); silence(t); soundTwo(NOTE_F4,NOTE_A4,t); silence(tt); soundTwo(NOTE_F4,NOTE_A4,t); soundsOne(NOTE_F3,t); silence(t); soundThree(NOTE_F4,NOTE_A4,NOTE_G3,t); silence(t); soundTwo(NOTE_E4,NOTE_G4,t); silence(t); soundsOne(NOTE_B3,t); soundTwo(NOTE_D4,NOTE_F4,t); silence(tt); soundThree(NOTE_C4,NOTE_E4,NOTE_G3,t); silence(t); soundTwo(NOTE_A3,NOTE_C4,t); silence(t); soundsOne(NOTE_G3,t); silence(t); soundTwo(NOTE_F3,NOTE_A3,t); silence(t); soundThree(NOTE_E3,NOTE_G3,NOTE_C4,t); silence(t); soundsOne(NOTE_C4,t); silence(t); soundsOne(NOTE_G3,t); silence(ttt); } void marioa(){ soundThree(NOTE_G3,NOTE_B3,NOTE_G3,t); silence(t); soundTwo(NOTE_D4,NOTE_F4,t); silence(ttt); soundThree(NOTE_D4,NOTE_F4,NOTE_G3,t); silence(t); soundThree(NOTE_D4,NOTE_F4,NOTE_G3,t); silence(t); soundThree(NOTE_C4,NOTE_E4,NOTE_A3,t); silence(tt); soundThree(NOTE_B3,NOTE_D4,NOTE_B3,t); silence(tt); soundThree(NOTE_G3,NOTE_C4,NOTE_C4,t); silence(t); soundsOne(NOTE_E3,t); silence(t); soundsOne(NOTE_G3,t); silence(t); soundsOne(NOTE_E3,t); silence(t); soundTwo(NOTE_C3,NOTE_C3,t); silence(tvii); } ================================================ FILE: Lesson 8 - Tilt Ball Switch/Magic_8-Ball/Magic_8-Ball.ino ================================================ /* For the Lession 7 - Tilt Ball Switch * Magic-8 ball using an LCD display * by Ricardo Moreno * https://github.com/rmorenojr/ElegooTutorial * * Inspired by Arduino Video Tutorial-07 Crystal Ball Magic Ball - by Arduino * https://www.youtube.com/watch?v=kmIy1Y0Jwo8 * * Arduino LiquidCrystal web page * https://www.arduino.cc/en/Reference/LiquidCrystal * https://github.com/codebendercc/arduino-library-files/tree/master/libraries/LiquidCrystal * */ #include //Initialize library with LCD screen //LiquidCrystal(rs, enable, d4, d5, d6, d7) // or //LiquidCrystal(rs, rw, enable, d4, d5, d6, d7) LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); //instantiates the LiquiCrystal Object class to variable lcd //Global Constants const int tiltSensorPin = 6; //Global Variables bool currentSwitchState = LOW; //bool is the standard, and preferred type for boolean bool prevSwitchState = LOW; int reply; void setup(){ lcd.begin(16, 2); //16 characters and two lines pinMode(tiltSensorPin, INPUT_PULLUP); //sets the pinmode for the tilt sensor lcd.print("Ask the"); //prints the line of text lcd.setCursor(0,1); //moves the cursor to the next line lcd.print("Magic 8-Ball!"); //not sure if hyphen will work } void loop(){ currentSwitchState = debounce(prevSwitchState); //get the tilt sensor value HIGH or LOW if (currentSwitchState != prevSwitchState) { //looking for a change in the tilt sensor if (currentSwitchState == LOW) { //tilt sensor has made a connection lcd.clear(); //clear the screen reply = random(8); //random select a number from 0-7 lcd.setCursor(0, 0); //move cursor lcd.print("8-ball says:"); //print the line of text lcd.setCursor(0, 1); //move the cursor switch(reply){ //switch statement jumps to case with a reply value (0-7) case 0: lcd.print("Yes"); break; case 1: lcd.print("Most likely"); break; case 2: lcd.print("Certainly"); break; case 3: lcd.print("Outlook good"); break; case 4: lcd.print("Unsure"); break; case 5: lcd.print("Ask again"); break; case 6: lcd.print("Doubtful"); break; case 7: lcd.print("No"); break; } } else { //Detected that the switch is HIGH or tilted down lcd.clear(); //clear the screen lcd.setCursor(0, 0); //move cursor lcd.print("8-ball says:"); //print the line of text lcd.setCursor(0, 1); //move the cursor } } //Save the current state into previous state prevSwitchState = currentSwitchState; } /* *********************************************************** * Functions * *********************************************************** */ //Debouncing function bool debounce(boolean last){ //Local Variable bool current = digitalRead(tiltSensorPin); if(last != current){ delay(100); //100 milliseconds current = digitalRead(tiltSensorPin); } return current; } ================================================ FILE: Lesson 8 - Tilt Ball Switch/README.md ================================================ # ElegooTutorial ## Lesson 8 – Tilt Ball Switch and the Magic 8-ball [YouTube Video](https://youtu.be/1uXvVbkz45o) A beginner's guide to the Most Complete Starter Kit by Elegoo. **Lesson 8 – Tilt Ball Switch** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 8 “Tilt Ball Switch”. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. I’m pronouncing it El-E-Goo, I hope that’s right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, we’ll need a few things from your Elegoo Arduino kit. I’ll list the items below. In this lesson we’re going to learn about the tilt sensor or the tilt ball switch is and how to use them in our projects. I step through the Elegoo provided code to explain how it makes this happen. This time we modified the sketch before we run the circuit to correct and update various parts of the code. For bonus sketch, I re-created the Magic 8-ball as shown in Arduino Video Tutorial-07 Crystal Ball Magic Ball - by Arduino. This time we get try the 1602 LCD display available in the kit. Another fun video to make. ## Parts you’ll need for the basic tutorial * Arduino UNO R3 board * Tilt Ball Switch * Two female-to-male jumpers ## The Bonus Magic 8-Ball parts * Arduino UNO R3 board * Tilt ball switch * 1602 LCD panel * 10K potentiometer * Two female-to-male jumpers wire * Various breadboard jumper wires * Breadboard The next lesson will be **Lesson 9 – Servo** ## Links This lesson’s sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoo’s web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [attachinterrupt](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/) * [Switch Case control](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) * [Arduino LiquidCrystal web page](https://www.arduino.cc/en/Reference/LiquidCrystal) * [codebendercc LiquidCrystal](https://github.com/codebendercc/arduino-library-files/tree/master/libraries/LiquidCrystal) * [Inspired by Arduino Video Tutorial-07 Crystal Ball Magic Ball](https://www.youtube.com/watch?v=kmIy1Y0Jwo8) - by Arduino * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_04_-_Magic_Mountain](http://freemusicarchive.org/music/Jahzzar/) This is the ninth video on a new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 8 - Tilt Ball Switch/myBall_Switch/myBall_Switch.ino ================================================ //www.elegoo.com //2016.12.08 /*****************************************/ //Using predefined LED_BUILTIN = 13 const int tiltSensorPin = 2; //the tilt ball switch pin void setup() { pinMode(LED_BUILTIN, OUTPUT); //initialize the ledPin as an output pinMode(tiltSensorPin,INPUT_PULLUP); //set the tilt switch input and set to high using pull up resistors } /******************************************/ void loop() { int digitalVal = digitalRead(tiltSensorPin); //Returns a HIGH or LOW if(digitalVal) { digitalWrite(LED_BUILTIN, LOW); //turns the led off } else { digitalWrite(LED_BUILTIN, HIGH); //turns the led on } } /**********************************************/ ================================================ FILE: Lesson 9 - Servo/README.md ================================================ # ElegooTutorial ## Lesson 9 Servo and the Rotary Encoder [YouTube Video](https://youtu.be/1GDnMXXSq18) A beginner's guide to the Most Complete Starter Kit by Elegoo. **Lesson 9 Servo** Hello everyone, I'm Rick the Tech Enthusiast here with the next Lesson number 9 Servo. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the tutorial closely, without overburdening the viewer with every detail, but I will point out any changes or corrections as I find them. As mentioned before, I purchased this Elegoo starter kit. Im pronouncing it El-E-Goo, I hope thats right (I sometimes slip and say El-a-Goo). No, Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment. For this video, well need a few things from your Elegoo Arduino kit. Ill list the items below. In this lesson were going to learn about the servo SG90 provided in the kit and how to use them in our projects. I step through the Elegoo provided code to explain how it makes this happen. Then I develop a sketch to adjust the servo using a rotary encoder to find the 180 degree rotation end points in microseconds. That way the servo can be properly setup in any future projects. The adjustment circuit also included an OLDE and RGB LED. I several setbacks, and discuss using interrupts, pin change interrupts and port registers to get the most out of the rotary encoder. I hope it can be beneficial to someone with their project. ## Parts youll need for the basic tutorial * Elegoo Arduino UNO R3 board * Servo SG90 * Three male-to-male jumpers ## The Servo Adjustment circuit parts * Elegoo Arduino UNO R3 board * Servo SG90 * Rotary Encoder module * RGB LED * OLED (purchase separately) * Four 10K-ohm resistors * Three 220-ohm resistors * Two 22pF capacitors * One 0.1 uF capacitor * 5 female-to-male jumper wires * 11 male-to-male jumper wires * Various breadboard jumper wires * Breadboard The next lesson will be **Lesson 10 Ultrasonic Sensor Module** ## Links This lessons sketch and associated drawings can be found at [Github](https://github.com/rmorenojr/ElegooTutorial) * SunFounder LCD1602 Module with 3.3V Backlight for Arduino Uno R3 Mega2560 Raspberry Pi 16x2 Character White on Blue Background * Cylewet 10Pcs 5V 2 Terminals Passive Electronic Alarm Buzzer Electromagnetic Beeper AC Impedance for Arduino (Pack of 10) CYT1008 * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) * [Elegoos web site](https://www.elegoo.com/) - [Complete Starter Kit](https://www.elegoo.com/product/elegoo-uno-r3-project-complete-starter-kit/) * [Fritzing Software](http://fritzing.org/download/) * [Arduino Language Reference (English)](https://www.arduino.cc/reference/en/) * [attachinterrupt](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/) * [Switch Case control](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) * [Pin Change Interrupt](http://playground.arduino.cc/Main/PinChangeInterrupt) * [Port Registers](https://www.arduino.cc/en/Reference/PortManipulation) * [How to Use a Rotary Encoder in an MCU-Based Project](https://www.allaboutcircuits.com/projects/how-to-use-a-rotary-encoder-in-a-mcu-based-project/) * [Efficiently Reading Quadrature with Interrupts](http://makeatronics.blogspot.com/2013/02/efficiently-reading-quadrature-with.html) BY MAKEATRONICS * [Tutorial: Using Servo Motors and Analog Inputs with the Arduino](https://www.youtube.com/watch?v=qatqVNh9uj4) * [How Rotary Encoder Works and How To Use It with Arduino](https://www.youtube.com/watch?v=v4BbSzJ-hz4) * [Rotary Encoder Tutorial with Arduino Code](https://www.youtube.com/watch?v=HQuLZHsGZdI) * [Arduino UNO Tutorial 6 - Rotary Encoder](http://www.hobbytronics.co.uk/arduino-tutorial6-rotary-encoder) * [Hands On Arduino 5A: SPI Communication](https://www.youtube.com/watch?v=Fj8IuivkQWI) BY Robert Paz * [Interrupts](http://gammon.com.au/interrupts) BY Nick Gammon * Music provided by Free Music Archive, by artist Jahzzar - [Jahzzar_-_04_-_Magic_Mountain](http://freemusicarchive.org/music/Jahzzar/) This is the ninth video on a new Arduino tutorial series. If you like the series, be sure to rate and subscribe. Thanks for watching ================================================ FILE: Lesson 9 - Servo/ServoRangeCal_Ctrl/ServoRangeCal_Ctrl.ino ================================================ /* Servo Range Calibrator Sketch * by Ricardo Moreno Jr. * 02/03/2018 * * Arduino Servo Library * https://www.arduino.cc/en/Reference/Servo * https://github.com/arduino-libraries/Servo * Arduino Pin Change Inpterrupt * http://playground.arduino.cc/Main/PinChangeInterrupt * * Servo - Class for manipulating servo motors connected to Arduino pins. * methods: attach(pin) - Attaches a servo motor to an i/o pin. attach(pin, min, max) - Attaches to a pin setting min and max values in microseconds default min is 544, max is 2400 write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds) writeMicroseconds() - Sets the servo pulse width in microseconds read() - Gets the last written servo pulse width as an angle between 0 and 180. readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release) attached() - Returns true if there is a servo attached. detach() - Stops an attached servos from pulsing its i/o pin. * * Use the push button the the rotary encoder to start the calibration * Afterwards used the knog to turn the servo. * * attachInterrupt(digitalPinToInterrupt(pin), InterruptServiceRoutines, mode) * https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/ * Arduino UNO - pins 2, 3 for interrupts 0, 1 * Note: * Inside the attached function, delay() won't work and the value returned by millis() * will not increment. Serial data received while in the function may be lost. You should * declare as volatile any variables that you modify within the attached function. See * the section on ISRs below for more information. * Note about Rotary Encoder - it is difficult to reduce the contact bouncing without some * discrete components. Circuit uses an inline resistor and capacitor. Also see * Kevin Darrah * https://www.youtube.com/watch?v=HQuLZHsGZdI */ /* ****************** INCLUDE LIBRARIES ********************** */ #include #include Servo myServo; //Instantiate a Servo object // twelve servo objects can be created on most boards /* ******************* GLOBAL CONSTANTS ********************** */ //OLED Pins const int oledClkpin = 13; const int oledMosipin= 12; const int oledRespin = 11; const int oledDCpin = 10; const int oledCSpin = 9; //Instantiate U8G2 object - Plus Pins U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ oledClkpin, /* data=*/ oledMosipin, /* cs=*/ oledCSpin, /* dc=*/ oledDCpin, /* reset=*/ oledRespin); //Using the KY-040 Rotary Encoder Module const int ePin_A = A1; //Encoder clock pin or Encoder pin A const int ePin_B = A0; //Encoder DT signal pin or Encoder pin B const int ePin_Button = 3; //Encoder SW pin Normally Open push button - Also Interrupt 1 //Servo SG90 const int myServoPin = 2; //Servo pin //RGB LED const int bLEDPin = 5; const int gLEDPin = 6; const int rLEDPin = 7; /* ******************* GLOBAL VARIABLES ********************** */ //servo ranges in microseconds int imin = 625; // servo's absolute iminmum position in microseconds - through testing int imax = 2625; // servo's absolute imaxmum position in microseconds - through testing int minPos = imin; // My Initial value is 735 - determined through trial and error int maxPos = imax; // My initial value is 2349 - determined through trial and error volatile bool ebutton = false; // Store adjustment mode state - Used by interrupt volatile long eCounter = 0; // Stores rotary counts - Used by interrupt bool bRotateLt = true; // Stores the servo rotation direction state int maxBright = 220; // Adjust LED brightness /* ******************** SETUP FUNCTIONS ********************** */ void pciSetup(byte pin){ //Setup function to setup Pin change interrupts *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable: pin PCMSK1 |= bit (PCINT8) PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt: (PCIF1) PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group: (PCIE1) } /* *********************** VOID SETUP ************************ */ void setup(){ //if (F_CPU == 16000000) clock_prescale_set(clock_div_1); myServo.attach(myServoPin, minPos, maxPos); // Sets up Servo class object - datasheet values are not correct // (pin#, pulse min microseconds, pulse max microseconds) // (pin#, 544, 2400) - default values in library //Setting up section A0-A5 for (int i=A0; i<=A5; i++) { pinMode(i, INPUT_PULLUP); // All pins are inputs with pull-up resistors } //pinMode(ePin_A, INPUT_PULLUP); // Encoder Clk pin A with pull up resistors //pinMode(ePin_B, INPUT_PULLUP); // Encoder DT signal pin B with pull up resistors pinMode(ePin_Button, INPUT_PULLUP); // Encoder button pin with pull up resistors pinMode(bLEDPin, OUTPUT); // RGB LED pinMode(gLEDPin, OUTPUT); pinMode(rLEDPin, OUTPUT); //Attach to interrupt 1 on pin 3 attachInterrupt(digitalPinToInterrupt(ePin_Button), eButton_isr, CHANGE); //Use Pin Change interrupt for A0 & A1 pciSetup(ePin_A); // Encoder Clk pin A pciSetup(ePin_B); // Encoder DT signal pin B Serial.begin(115200); // Enable the serial monitor setColor(0,maxBright,0); // set the RGB LED to green //OLED Diplay /* U8g2 Project: SSD1306 OLED SPI Board */ pinMode(oledDCpin, OUTPUT); pinMode(oledDCpin, OUTPUT); digitalWrite(oledDCpin, 0); digitalWrite(oledDCpin, 0); u8g2.begin(); //Initial Serial Monitor Startup help message Serial.println("This routine helps you fine tune"); Serial.println("your servo's min and max values"); Serial.println("When the servo reaches either "); Serial.println("0 or 180 degrees, press the Encoder"); Serial.println("button to fine tune the value"); Serial.println(""); } /* *********************** VOID LOOP ************************* */ void loop() { //Check to see of Encoder button is pushed - test can be performed more that once if (ebutton==true){ // Encoder button has been pressed ebutton=false; //Adjustment mode routine Serial.println("Adjustment mode Started"); //Go into edit mode int pos = myServo.readMicroseconds(); // Read current postion in microseconds int midPos = round((maxPos-minPos)/2); if (pos <= midPos){ // current postion less that 90 degrees or half range Serial.println("Adjust until 0 degrees"); // if you are closer to zero, assume adjusting min } else { // current position greater than 90 degrees or half range Serial.println("Adjust until 180 degrees"); // if you are closer to 180, assume adjusting max } Serial.print("Current postion in Microseconds = "); Serial.println(pos); ebutton=false; // Just to make sure setColor(maxBright,maxBright/2,0); // RGB LED to Yellow //Loop until ebutton while (!ebutton){ // Wait intil done adjusting (button press) doEncoder(); } delay(1000); eCounter=0; ebutton=false; Serial.print("New min = "); Serial.print(minPos); Serial.print(" New max = "); Serial.println(maxPos); Serial.println("Make these changes to the code"); Serial.println(""); } else { serverRotate(bRotateLt); bRotateLt = !bRotateLt; // Switch direction Serial.println("Press button to adjust"); } setColor(0,maxBright,0); // RGB LED to Green delay(3000); // Wait 3 seconds for user input } /* *********************************************************** * Functions * *********************************************************** */ void draw(int cPos, int indicator=1){ /*draw - refresh the OLED screen * Parameters: * cPos - current position in microseconds * [optional] indicator - move the indicator disc above * 0 - min * 1 - cpos * 2 - max */ //Error checking if ((indicator > 2)||(indicator < 0)) indicator=1; int indTable[] = {20,64,106}; u8g2.firstPage(); do { // draw(minPos, Pos, maxPos); // select font u8g2.setFont(u8g2_font_9x15B_tf); u8g2.drawStr(2,15,"Servo Adjuster"); //draw two lines u8g2.drawLine(2,20,124,20); //x0,y0,x1,y1 u8g2.drawHLine(2,22,123); //x,y,w //Move Indicator dot into postion u8g2.drawDisc(indTable[indicator], 28, 3, U8G2_DRAW_ALL); u8g2.drawStr(5,45,"Min"); u8g2.drawStr(45,45,"CPOS"); u8g2.drawStr(95,45,"Max"); u8g2.setCursor(2,60); u8g2.print(minPos); u8g2.setCursor(45,60); u8g2.print(cPos); u8g2.setCursor(90,60); u8g2.print(maxPos); } while ( u8g2.nextPage() ); } void setColor(int redValue, int greenValue, int blueValue){ /*setcolor - RGB LED color - from Lesson 4 * *Parameters: * redvalue - 0-255 * greenValue - 0-255 * blueValue - 0-255 */ analogWrite(rLEDPin, redValue); analogWrite(gLEDPin, greenValue); analogWrite(bLEDPin, blueValue); } void turnServo(int posMicroseconds, int indicator=1, bool skip=false){ /*turnServo - turns the servo and calls draw to repaint the OLED screen * * Parameters: * posMicroseconds - servo position in microseconds * [optional]indicator - passed value to the draw function * [optional]skip - calls the draw function after every 30 posMicroseconds */ myServo.writeMicroseconds(posMicroseconds); // Rotate Servo in microseconds //Skip overide - if it's close to min max values, don't skip if((posMicroseconds<=(minPos *1.001))||(posMicroseconds>=(maxPos *.999))){skip=false;} if (skip){ //May skip the draw function if true if (posMicroseconds%30==0) { draw(posMicroseconds, indicator); //skips the draw function if posMicroseconds is not evenly divisable by 30 } else { delay(1); } } else { //call the draw function draw(posMicroseconds, indicator); } } void serverRotate(bool turnLeft){ /*serverRotate - Rotates the servo the range set by the * the minimum Postion and maximum Postion * Note: maxpos !> imax && minpos !< imin *Parameters: *turnLeft - provides the rotation direction */ bool ledState = true; int pos; if (turnLeft) { // rotate left Serial.println("One moment...Rotating left from 0 to 180"); for (pos = minPos; pos <= maxPos; pos += 1) { // goes from 0 degrees to 180 degrees using MS // in steps of 1 degree turnServo(pos,1,true); //Blinks the LED if (pos%60==0){ setColor(maxBright*ledState,0,0); ledState=!ledState; } } } else { // rotate Right Serial.println("One moment...Rotating right from 180 to 0"); for (pos = maxPos; pos >= minPos; pos -= 1) { // goes from 180 degrees to 0 degrees using MS turnServo(pos,1,true); //Blinks the LED if (pos%60==0){ setColor(maxBright*ledState,0,0); ledState=!ledState; } } } } void doEncoder(){ /*doEncoder - gets the rotary encoder values and adjusts * the minPos or maxPos depending when user * initiates the adjustment mode */ //Local Variables int pos = myServo.readMicroseconds(); //Read current postion in microseconds int midPos = round((maxPos-minPos)/2); //Since the encoder can go faster than the function or servo pos += eCounter; //Add eCounter to position eCounter = 0; //reset eCounter if (pos <= midPos){ //Adjusting minimum if (pos>=imin) { //checking pos size //Note servo function will not go less than original minPos minPos = pos; turnServo(pos,0); } else { //Set to imin pos = imin; //Set pos to imin turnServo(pos,0); Serial.print ("Already at minimum "); Serial.println(imin); } } else { //Adjusting maximum if (pos<=imax){ //checking pos size //Note servo function will not go less than original maxPos maxPos = pos; //Serial.print("Changing maxPos to "); Serial.println(pos); turnServo(pos,2); } else { //Set pos to imax pos = imax; turnServo(pos,0); Serial.print ("Already at maximum "); Serial.println(imax); } } } void eButton_isr(){ // Encoder button Interrupt Service Routine using an interrupt ebutton = true; } // encoder_isr() // Pin Change Interrupt Request 1 (pins A0 to A5) (PCINT1_vect) // This low level coding is used to handle a chnage for a group of pins ISR (PCINT1_vect) { // handle pin change interrupt for A0 to A5 here // the above ISR name is required // this routine is one of the fastest ways to // to capture the quadrature movement in the // Encoder. Using a single interrupt on pin 2 // and half resolution would also be an option. /* Truth table * LastPinA | LastPinB | PinA | PinB | int | Rotate * 0 0 0 0 | 0 | 0 * 0 0 0 1 | 1 | -1 * 0 0 1 0 | 2 | 1 * 0 0 1 1 | 3 | 0 * 0 1 0 0 | 4 | 1 * 0 1 0 1 | 5 | 0 * 0 1 1 0 | 6 | 0 * 0 1 1 1 | 7 | -1 * 1 0 0 0 | 8 | -1 * 1 0 0 1 | 9 | 0 * 1 0 1 0 | 10 | 0 * 1 0 1 1 | 11 | 1 * 1 1 0 0 | 12 | 0 * 1 1 0 1 | 13 | 1 * 1 1 1 0 | 14 | -1 * 1 1 1 1 | 15 | 0 */ static int8_t lookup_table[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0}; static uint8_t enc_val = 0; enc_val = enc_val << 2; //Saves history /*Analog pins A0-A5 PINC reads all the pins A0-A5 but in this order A5,A4,A3,A2,A1,A0 That's why PinA is on A1 and PinB in on A0 that way the bits are in the right order 0b11 = PinA PinB If you change order, you'll need to redo the truth table above. First we AND a bit mask to the pin read to hide the other pins: 0b11 No shift needed since they're already the last two binary bits. Next we OR the new value with historical. That gives us the truth table index value. Slick! */ enc_val = enc_val | (PINC & 0b11); // Again AND a bit mask to hide other values (old history), // Remember a byte is 8 bits long. // The index value from Table returns the movement eCounter += lookup_table[enc_val & 0b1111]; } ================================================ FILE: README.md ================================================ # ElegooTutorial Elegoo tutorials Ricardo Moreno Jr. Modified and Bonus material for The Most Complete Starter Kit for the Arduino Uno by **Elegoo** YouTube Tutorials. This Project will be divided into Lesson folders that hold all the various modified sketches, bonus material, schematics, wiring diagrams and any support materials for the Elegoo Arduino UNO Tutorial Series. [YoutTube Arduino Video Series](https://www.youtube.com/playlist?list=PLMzVxVmsv2vnCy0GSZjXaMdBQKLbmHOZR) ================================================ FILE: UNLICENSE ================================================ This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to ================================================ FILE: _config.yml ================================================ theme: jekyll-theme-cayman ================================================ FILE: library.properties ================================================ name=ElegooTutorial version=1.0.0 author=Ricardo Moreno Jr. maintainer=Ricardo Moreno Jr. sentence=Modified and Bonus material for The Most Complete Starter Kit for the Arduino Uno by Elegoo YouTube Tutorials. paragraph=This directory contains various updated and bonus circuits, schematics, wiring diagrams developed for the Elegoo Arduino Tutorial series. https://www.youtube.com/watch?v=xmRk_wU3lhQ&list=PLMzVxVmsv2vnCy0GSZjXaMdBQKLbmHOZR category=Tutorial url=https://github.com/rmorenojr/ElegooTutorial/ architectures=avr includes=none