Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. WRITE THE CODE FOR A PIEZO BUZZER. USE THE CODE GIVEN AS A TEMPLATE TO COMPLETE THE CODE PLEASE. Lab #4 Assignment Part 1.Write

.image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedWRITE THE CODE FOR A PIEZO BUZZER. USE THE CODE GIVEN AS A TEMPLATE TO COMPLETE THE CODE PLEASE.

Lab #4 Assignment Part 1.Write a program that will read a single human readable character from the serial monitor and send back a string that represents the Morse code pattern for that character. Morse Code Table (edit, _=dah) Pattern Character S/S T/t Pattern Character A/a B/b C/C D/d E/ U/ V/v W/W F/f X/x G/g Y/y H/h Z/Z 1/ J/ K/k L/1 M/m N 0/0 P/P Q/4 R/T Some notes of how to design your program: Patterns can be represented as an array of characters like this: char pattern[26][7] = {"* ",//A, a ***",//B,b next page. etc In order to save some typing time, we've included the declarations for the pattern array on the The pattern array first index goes from O up to 25 (26 element). For example, pattern[2]0="_*_*", where pattern[2][1]= (*) From the ASCII table on Page 6, you can notice the following: The characters A,B,C,D,E...Z have the following decimal representation 65,66,67,68,69....90. [Increment of 11 By subtracting 65 from each character (if it was between A and 2), the result is a number between 0 and 25 (26 character), this number can be used as the first index for the array. For the second index, use a for loop. char pattern [26] [7]={ //A, a "***",//Bb "**",//c,c //D, //E, ***",//F, //G,g "****",//h, h //I, i ",//J. //K, ***",//L,1 //M,m //Nin 170,0 //P.P ,//0,9 //R, //S,s //T,t //U, ,//v, v //WW ***",//xix ",//Y, ** 1/2,2 const int piezoPin = 9; char c; int indexl=0, index2=0; void setup() { // put your setup code here, to run once: Serial.begin(9600); delay(100); Serial.println("Ready!"); pinMode (piezoPin, OUTPUT); } void loop() { // put your main code here, to run repeatedly: if (Serial.available()) { 1/ Cont on Nxt page c=Serial.read(); index1=-1; //between A and z if (c>='A' &&0=0&&indexl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

=+ Of the HR issues mentioned in the case,

Answered: 1 week ago