Created
April 21, 2024 02:15
-
-
Save AlejandroVelasco/7e531c80f264e4d7b3f6b43394b82e7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() { | |
| // Definir los números | |
| int n1 = 10, n2 = 4, n3 = 6; | |
| // Calcular la media aritmética | |
| int media = (n1 + n2 + n3) / 3; | |
| // Código para el microcontrolador, para demostrar el resultado. | |
| DDRB |= (1 << PB5); // Establecer PB5 como salida | |
| while (1) { | |
| if (media >= 0 && media <= 255) { | |
| PORTB |= (1 << PB5); // Encender LED si el resultado es válido | |
| } else { | |
| PORTB &= ~(1 << PB5); // Apagar LED si el resultado no es válido | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment