group

parent 051489fe
Pipeline #83802 passed with stage
in 18 seconds
#include <avr/io.h>
#include <util/delay.h>
#define output(directions,pin) (directions |= pin) // set port direction for output
#define set(port,pin) (port |= pin) // set port pin
#define clear(port,pin) (port &= (~pin)) // clear port pin
#define pin_test(pins,pin) (pins & pin) // test for port pin
#define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set
#define PWM_delay() _delay_us(50) // PWM delay
#define led_port PORTB
#define led_direction DDRB
#define red (1 << PB1)
#define green (1 << PB0)
#define blue (1 << PB2)
int main(void) {
//
// main
//
unsigned char count, pwm;
//
// set clock divider to /1
//
CLKPR = (1 << CLKPCE);
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
//
// initialize LED pins
//
set(led_port, red);
output(led_direction, red);
set(led_port, green);
output(led_direction, green);
set(led_port, blue);
output(led_direction, blue);
//
// main loop
//
while (1) {
//LED BLUE ON/OFF
clear(led_port,blue);
_delay_ms(1000);
set(led_port,blue);
_delay_ms(1000);
//LED GREEN ON/OFF
clear(led_port,green);
_delay_ms(1000);
set(led_port,green);
_delay_ms(1000);
//LED RED ON/OFF
clear(led_port,red);
_delay_ms(1000);
set(led_port,red);
_delay_ms(1000);
}
}
//
//
// hello.RGB.45.c
//
// RGB LED software PWM hello-world
//
// Neil Gershenfeld
// 11/10/10
//
// (c) Massachusetts Institute of Technology 2010
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose. Copyright is
// retained and must be preserved. The work is provided
// as is; no warranty is provided, and users accept all
// liability.
//
#include <avr/io.h>
#include <util/delay.h>
#define output(directions,pin) (directions |= pin) // set port direction for output
#define set(port,pin) (port |= pin) // set port pin
#define clear(port,pin) (port &= (~pin)) // clear port pin
#define pin_test(pins,pin) (pins & pin) // test for port pin
#define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set
#define PWM_delay() _delay_us(50) // PWM delay
#define led_port PORTB
#define led_direction DDRB
#define red (1 << PB1)
#define green (1 << PB0)
#define blue (1 << PB2)
int main(void) {
//
// main
//
unsigned char count, pwm;
//
// set clock divider to /1
//
CLKPR = (1 << CLKPCE);
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
//
// initialize LED pins
//
set(led_port, red);
output(led_direction, red);
set(led_port, green);
output(led_direction, green);
set(led_port, blue);
output(led_direction, blue);
//
// main loop
//
while (1) {
for (count = 0; count < 255; ++count) {
clear(led_port,red);
for (pwm = count; pwm < 255; ++pwm)
PWM_delay();
set(led_port,red);
for (pwm = 0; pwm < count; ++pwm)
PWM_delay();
}
}
}
......@@ -166,7 +166,74 @@
<center><video width="680" height="400" src="images/week12/videoRGBc.mp4" autoplay muted loop></video> </center>
<h2>Group</h2>
Working.
The group work this week, asks us to measure the consumptions of the board, for this case we have used the<a href="http://academy.cba.mit.edu/classes/output_devices/RGB/hello.RGB.45.png"> basic example of a led RGB of Neil</a> and the output devices board of our partner<a href="http://fabacademy.org/2019/labs/cit/students/italo-samaniego/week12.html"> Italo</a>.
The contribution on my part was to measure the amperage consumption values, for this the ON / OFF programming of the RGB LEDs is upload to the board.
<a title="Group"><img class="image center" src="images/week12/group.jpg"></a>
Since we can not measure current intensity directly, we will use the formula of Ohm's law:<code> V = IxR</code>.<br>
The real values of the resistances are the following:
<div class="table-wrapper">
<table class="alt">
<thead>
<tr>
<td>Nominal Value</td>
<td>Real Valuel</td>
</tr>
</thead>
<tbody>
<tr>
<td>Red Resistor: 1 kΩ</td>
<td>0.998 Ω</td>
</tr>
<tr>
<td>Green Resistor: 1 kΩ</td>
<td>0.998 Ω</td>
</tr>
<tr>
<td>Blue Resistor: 499 Ω</td>
<td>498.6 Ω</td>
</tr>
</tbody>
</table>
</div>
While the real values of the voltages in each resistance are the following:
<div class="table-wrapper">
<table class="alt">
<tbody>
<tr>
<td>Red Voltage</td>
<td>3.120 V</td>
</tr>
<tr>
<td>Green Voltage</td>
<td>3.120 V</td>
</tr>
<tr>
<td>Blue Voltage</td>
<td>2.244 V</td>
</tr>
</tbody>
</table>
</div>
Using the ohm law, we have the final values of the currents:
<div class="table-wrapper">
<table class="alt">
<tbody>
<tr>
<td>Red Current</td>
<td>3.12 mA</td>
</tr>
<tr>
<td>Green Current</td>
<td>3.12 mA</td>
</tr>
<tr>
<td>Blue Current</td>
<td>4.5 mA</td>
</tr>
</tbody>
</table>
</div>
To see all the documentation of the group work, you can visit the CIT page.
<h2>Download files</h2>
You can download files Here: <br>
......@@ -186,6 +253,10 @@
Manufacturing<br>
<a href="images/week12/traces.png" download>Traces</a><br>
<a href="images/week12/out.png" download>Out</a><br>
Gropu Code in C<br>
<a href="images/week11/grupalONOFF.ino" download>On / Off code</a><br>
<a href="images/week11/grupalPWM.ino" download>PWM code</a><br>
</p>
<p><ul class="actions">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment