can you code the LED to turn on odd and even numbers? How can you make an LED rise one square over time? The total number of LEDs is 7.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter3: Understanding Structure
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question
How can you code the LED to turn on odd and even numbers? How can you make an LED rise one square over time? The total number of LEDs is 7.
1 //-------| src/led.c |-------//
2 ||
3 #include "led.h"
4
5 static short * led;
6
7 void init_led(short * address) {
led = address;
8
9 }
10
11 void led_stack() { ,
12
13
int i;
for( i=1; i<=16 ; i++ ) {
if ( i%2 ==
*led =
1 ) {
(short)~0XFF|;
14
15
16
}
else {
17
18
*led = (short)~0x00;
19
20
21
22 }
23
}
usleep(100000);
}
Transcribed Image Text:1 //-------| src/led.c |-------// 2 || 3 #include "led.h" 4 5 static short * led; 6 7 void init_led(short * address) { led = address; 8 9 } 10 11 void led_stack() { , 12 13 int i; for( i=1; i<=16 ; i++ ) { if ( i%2 == *led = 1 ) { (short)~0XFF|; 14 15 16 } else { 17 18 *led = (short)~0x00; 19 20 21 22 } 23 } usleep(100000); }
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning