3528
Comentario:
|
4317
Agregando informacion de licenciamiento
|
Los textos eliminados se marcan así. | Los textos añadidos se marcan así. |
Línea 12: | Línea 12: |
{{attachment:hl-bcd.png}} |
|
Línea 14: | Línea 16: |
HOLA Ing. Alberto Medrano */ |
* Print "HOLA" into 7 segment array display * * (c) 2010 Alberto Medrano (alberto@cenditel.gob.ve) * CENDITEL Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
Curso Sensibilización Hardware Libre (Unidad 002)
Tabla de Contenidos
002/04 Actividad 004
/* * Print "HOLA" into 7 segment array display * * (c) 2010 Alberto Medrano (alberto@cenditel.gob.ve) * CENDITEL Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ int potPin = 0; // select the input pin for the potentiometer int val = 0; int common_0 = 12; int common_1 = 11; int common_2 = 10; int common_3 = 9; int bcd_A = 8; int bcd_B = 7; int bcd_C = 6; int bcd_D = 5; int bcd_E = 4; int bcd_F = 3; int bcd_G = 2; void setup() { pinMode(common_0, OUTPUT); // Declarando Salidas pinMode(common_1, OUTPUT); // Declarando Salidas pinMode(common_2, OUTPUT); // Declarando Salidas pinMode(common_3, OUTPUT); // Declarando Salidas pinMode(bcd_A, OUTPUT); // Declarando Salidas pinMode(bcd_B, OUTPUT); // Declarando Salidas pinMode(bcd_C, OUTPUT); // Declarando Salidas pinMode(bcd_D, OUTPUT); // Declarando Salidas pinMode(bcd_E, OUTPUT); // Declarando Salidas pinMode(bcd_F, OUTPUT); // Declarando Salidas pinMode(bcd_G, OUTPUT); // Declarando Salidas digitalWrite(common_0, LOW); digitalWrite(common_1, LOW); digitalWrite(common_2, LOW); digitalWrite(common_3, LOW); } void loop() { val = analogRead(potPin); // read the value from the sensor digitalWrite(bcd_A, LOW); // H digitalWrite(bcd_B, HIGH); digitalWrite(bcd_C, HIGH); digitalWrite(bcd_D, LOW); digitalWrite(bcd_E, HIGH); digitalWrite(bcd_F, HIGH); digitalWrite(bcd_G, HIGH); digitalWrite(common_0, HIGH); delay(val); digitalWrite(common_0, LOW); val = analogRead(potPin); // read the value from the sensor digitalWrite(bcd_A, HIGH); // O digitalWrite(bcd_B, HIGH); digitalWrite(bcd_C, HIGH); digitalWrite(bcd_D, HIGH); digitalWrite(bcd_E, HIGH); digitalWrite(bcd_F, HIGH); digitalWrite(bcd_G, LOW); digitalWrite(common_1, HIGH); delay(val); digitalWrite(common_1, LOW); val = analogRead(potPin); // read the value from the sensor digitalWrite(bcd_A, LOW); // L digitalWrite(bcd_B, LOW); digitalWrite(bcd_C, LOW); digitalWrite(bcd_D, HIGH); digitalWrite(bcd_E, HIGH); digitalWrite(bcd_F, HIGH); digitalWrite(bcd_G, LOW); digitalWrite(common_2, HIGH); delay(val); digitalWrite(common_2, LOW); val = analogRead(potPin); // read the value from the sensor digitalWrite(bcd_A, HIGH); // A digitalWrite(bcd_B, HIGH); digitalWrite(bcd_C, HIGH); digitalWrite(bcd_D, LOW); digitalWrite(bcd_E, HIGH); digitalWrite(bcd_F, HIGH); digitalWrite(bcd_G, HIGH); digitalWrite(common_3, HIGH); delay(val); digitalWrite(common_3, LOW); }