Question
This is an RTC clock that uses the TWI(I2C) interface which will be presented in more depth later in the course. Debugging note: Although theres
This is an RTC clock that uses the TWI(I2C) interface which will be presented in more depth later in the course.
Debugging note: Although there’s only one Elegoo library version, you may encounter other versions on the internet. They are usually valid but the names of the functions may be different and use different example codes. The version of the Elegoo library I have matches their example but if you start getting compile errors about undefined functions, this is something to check and ask about.
You should have a DS1307 but it’s possible some kits may have come with the DS3232. Make sure your library matches the part you have. It will say in your documentation which one you have.
- Find the lego RTC sketch in the code directory that you unzipped in a previous one. Install the library first if you haven’t already.
- Connect the RTC
- Upload the lego RTC sketch and verify it's printing at the correct time on the Serial Monitor.
- Their program will set the time on the RTC (you only need to do this once as long as the battery stays connected). The __DATE__ and __TIME__ are variables set by the compiler. The date and time are taken from the computer when you compile the code. If you leave this line it, it will update the time and date everytime you compile and upload.
- Display the current time on the LCD. The display should update at least once per second. You can try to fit it in on one of the lines or replace one of the lines from Part A with the time.
Procedures
- Paste a picture of your setup and a picture of the LCD screen working and showing the time
- Add comments to your combined code and paste it into your lab report
2 : Rotary Encoder
Read lesson 23 carefully to understand how the encoder works.
You can also view this video: https://www.youtube.com/watch?v=v4BbSzJ-hz4
This webpage discusses an encoder similar to what’s in your kit: https://lastminuteengineers.com/rotary-encoder-arduino-tutorial/
The encoders are a little flaky. If you turn too fast or don’t turn the right way, the count will sometimes skip, like going from 1 to 3. The 2 might be in there but it jumped to 3 before you could see it.
- Do lesson 26 (23) from the kit. You will have to move some pin assignments around but the rotary encoder needs to use pin 2. You can relocate the LCD pins to unused pins as necessary (remember to update those pin numbers in the program).
- Modify the program if needed to print out the rotary position number to the Serial Monitor. You should see it going up and down as you turn the encoder.
Procedures
- Paste a screenshot of the serial monitor showing how the count changes as you turn the encoder.
- Add comments to your combined code and paste it into your lab report.
Step by Step Solution
3.50 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
Procedures are a set of steps or instructions that are followed in a regulardefinite order to achieve a specific goal or outcomeThey are often used in ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started