Professional Documents
Culture Documents
const int M2Pin_C = 10; // # of the LED pin - C=Cafe - Must be PWM pin,
goes to motor (gate) const int ledPin_J = 3; // # of the LED pin - J=Jugo Must be PWM pin, goes to motor (gate)
const int ledPin_C = 5; // # of the LED pin - C=Cafe - Must be PWM pin,
goes to motor (gate)
const int ledPin_V = 13; // # of the LED pin - V=Vaso
// variables will change:
int buttonState_J = 0; // variable for reading the pushbutton status
int buttonState_C = 0; // variable for reading the pushbutton status
int ledState_V = 0; // variable for reading Led_V status
int intensity = 51*2; // Output Volt: 51*1 = 1 voltio; 51*3 = 3 Voltios
// Actual tension: 12 -12*(255-intensity)/255
// Output Volt / Actual Tension:
// 0,1,2,3,4,5 / 0, 2.4, 4.8, 7.2, 9.6, 12 - Calculado... //(0,1,2,3,4,5 / 0, 3.4,
5.6, 7.7, 9.9, 12 ) - Actual w/ BJT...
int photoresistor=0; //this is where our photoresistor Analog Voltage
Digital Value will be stored
void setup() {
// initialize the LED pin as an output:
lcd.init ();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Maquina de Jugo");
lcd.setCursor(5, 1);
lcd.print("Y Cafe");
pinMode(ledPin_J, OUTPUT);
pinMode(ledPin_C, OUTPUT);
pinMode(ledPin_V, OUTPUT);
pinMode(M2Pin_C, OUTPUT);
pinMode(M1Pin_J, OUTPUT); // initialize the pushbutton pin as an input:
pinMode(button_J, INPUT);
pinMode(button_C, INPUT);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
delay(1000);
lcd.clear();
}
void loop(){lcd.print(" Bienvenido"); // Imprime "Hola"...
lcd.setCursor(0, 1);
lcd.print(" Inserte el vaso");
photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328
Pin# 28 )
// read the state of the pushbutton value:
buttonState_J = digitalRead(button_J);
buttonState_C = digitalRead(button_C);
ledState_V = digitalRead(ledPin_V);
// check if pushbutton_J is pressed.
if (buttonState_J == HIGH && buttonState_C == LOW ) {
for ( int x=1; x<=100; x++ ) {
// delay = 30*100 = 3000 ms = 3 Segundos. Making this too small can
damage the motor
photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328
Pin# 28 )
Materiales
Fotoresistor
Diodos
Arduino Uno
Darlington Tip 120
Resistores de 10k
Pantalla LCD
Bombas de 12 V @ 1 A
LED
Botones
Observaciones:
En las tabla #4 solo se hace mencin a los componentes electrnicos,
sin embargo en en el desarrollo del proyecto se utilizaron otros
componentes como lo fueron madera y tubera (manguera).
Anexos