USING ENERGIA PLEASE DO THIS HW05-3 Develop an algorithm which generates an infi
ID: 3887763 • Letter: U
Question
USING ENERGIA PLEASE DO THIS
HW05-3 Develop an algorithm which generates an infinite loop with two LED outputs: Each iteration is approximately 1 second. . o Define one variable, LED1, for the Green LED o Define another variable, LED2, for the Red LED o Initialize an integer variable, X, to count the iterations. . The Green LED turns ON (500ms) every iteration. . The Red LED turns ON (500ms) once every tenth iteration. Document this algorithm using a flowchart or pseudo-code. . For a flowchart, use an online tool such as "draw.io" (or powerpoint). Hand-writte drawings (sketches) ARE NOT acceptable for this HW assignment. . For pseudo-code, use a simple text file and standard pseudo-code protocol Use the variable names specified and document (explain) any additional variables Submit this plan as a separate file (HW05-3.io, or HW05-3.ppt, or HW05-3.txt, etc * HW05-4 Write a Energia sketch which implements the algorithm developed in HW05-1. » Document this function with Energia comments, * Submit this Energia sketch as a separate file (HW05-4.ino) . Observe the operation of your sketch and verify that it matches your expectations.Explanation / Answer
#include<reg52.h> // special function register declarations
// for the intended 8051 derivative
sbit LED = P2^0; // Defining LED pin
void Delay(void); // Function prototype declaration
void main (void)
{
while(1) // infinite loop
{
LED = 0; // LED ON
Delay();
LED = 1; // LED OFF
Delay();
}
}
void Delay(void)
{
int j;
int i;
for(i=0;i<10;i++)
{
for(j=0;j<10000;j++)
{
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.