Save this video free

CE351 lec16 A music game box Task 2.3 and PWM introduction

Yiyan Li · 40:43 · Watch on YouTube

Part of Fort Lewis College CE351. See all 21 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Yiyan Li walks through the CE351 music-copy game in Task 2.3, showing how timer interrupts, song-state flags, and active-low button presses coordinate playback and compare the timing of a player's presses. The lecture then introduces pulse-width modulation (PWM), explaining duty cycle, why digital PWM can replace a DAC for many loads, and the limits of Arduino's analogWrite() when output frequency must be controlled.

Key takeaways

Chapters

0:00 Timer Interrupts Coordinate Note and Song Playback
3:00 Serial Command R Starts the Copy Song
11:00 Disable Timer 3 After the Copy Song
12:00 Initialize the Game and Record the First Press
18:00 Use Button Holds to Replay Notes and Capture Timing
22:00 Compare TCNT Intervals and Handle Timer Overflow
29:00 Play Success or Failure Songs from the Interrupt Routine
31:00 PWM Duty Cycle, analogWrite(), and Frequency Limits

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 uh song. Okay. So, playing the song. So, this this code can be found um on the website but partially. Okay. But now I'm giving you guys the solution here. So, playing the note coming coming to the first the first interrupt. Okay. It changes the TCNT count and then flip flip the flip the the pin. Okay. Playing the song is a inter is a independent interrupt routine follows the three states different states. First the first one is idle. If playing song is true start playing it and go to the next state put a plain note play note to be true and then directly give a number

0:49 to TC&T. So it's able to um use correct uh frequency for duration. Okay, for the duration and this one will keep running. These are independent. This is independent from this guy. So this is going to keep running playing the notes. Okay, as long as the play note flag is true. Okay, and when it gets into the rest, you reset, you change the number in the tent counter to the rest duration, right? And then um increment your your uh note index according. So this is a f this is a routine to run playing node and playing song and this will be used and this will be used for task 2.3 which is the very last one in that tutorial. I'm going to

1:37 show you what that is. Okay. Um it's over here. Okay. I'll play this video again to remind you about the final result. with the final result of game. First has a sharp stuff and I can push this

2:33 battery out. did it. Let's pay attention to this one. Okay. >> So, I I'm sending I'm sending a character through the US through the

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Yiyan Li.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.