Exemplo n.º 1
0
void printDateAndTime(LiquidCrystal & lcd, Date & date, Time & time) {
	lcd.clear();
	lcd.setCursor(0,0);
	date.print(lcd);
	lcd.setCursor(0,1);
	time.print(lcd);
}
Exemplo n.º 2
0
// Allows user to change and select the temperature point
//  	index: index of the current temperature point
int CurveInput::getTempPoint( int index )
{
	initLCD(&col, &row);
	lcd.print("Enter Temp ");
	lcd.print(index);
	lcd.print(" (C)");
	lcd.setCursor(0, 1);
	byte buttonID = NONE;
	int lowerLimit, upperLimit;
	temps[index] = getTempLimits(index, &lowerLimit, &upperLimit);
	int thisTemp = temps[index]; // scoping
	lcd.print(thisTemp);
	col = 0; row = 1;
	lcd.setCursor(col, row);
	delay(SELECT_DURATION);
	while ( buttonID != SELECT ) // any button other than SELECT
	{
		buttonID = btn.waitForButton();
		thisTemp = btn.actionIncDec(buttonID, TIME_TEMP_DURATION,
		                            col, row, thisTemp, 3,
									lowerLimit, upperLimit);
		                            // user adjusts temperature
	}
	return thisTemp;
}
Exemplo n.º 3
0
void loop() {
   lcd.clear();
  lcd.print("http://powerpacks." );
  lcd.setCursor( 0,1 );
  lcd.print("ArcolaEnergy.com");
  lcd.setCursor( 0,3 );

 lcd.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
  lcd.print(":");
  lcd.print(RTC.get(DS1307_MIN,false));//read minutes without update (false)
  lcd.print(":");
  lcd.print(RTC.get(DS1307_SEC,false));//read seconds
  lcd.print("      ");                 // some space for a more happy life
  lcd.print(RTC.get(DS1307_DATE,false));//read date
  lcd.print("/");
  lcd.print(RTC.get(DS1307_MTH,false));//read month
  lcd.print("/");
  lcd.print(RTC.get(DS1307_YR,false)); //read year 
 

digitalWrite( STATUS_OK, HIGH);
digitalWrite( STATUS_BAD, LOW );
  delay( 100 );
  digitalWrite( STATUS_OK, LOW);
digitalWrite( STATUS_BAD, HIGH );
delay( 100 );
}
void loop() {

   statoPulsante = digitalRead(6);
   if(statoPulsante != precedenteStatoPulsante)
      if (statoPulsante == LOW) {
         risposta = random(8);

         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print("La Palla dice:");
         lcd.setCursor(0,1);

       switch(risposta) {
          case 0: lcd.print("Si"); break;
          case 1: lcd.print("Molto probabilmente"); break;
          case 2: lcd.print("Certamemte"); break;
          case 3: lcd.print("Sembra di si"); break;
          case 4: lcd.print("Insicuro"); break;
          case 5: lcd.print("Domanda ancora"); break;
          case 6: lcd.print("Molto dubbio"); break;
          case 7: lcd.print("NO"); break;
          };
    };
   precedenteStatoPulsante = statoPulsante;   
}
Exemplo n.º 5
0
void loop() {
  noLight=digitalRead(digitalSignal);//
  lightness=analogRead(analogSignal); // и о его количестве
  // set the cursor to column 0, line 1
  lcd.setCursor(0, 0);
  //вывод сообщения
  Serial.print("There is ");
  
  lcd.clear();
  
  
  if (noLight) {
    Serial.println("1");
    lcd.print("1");
  }
  else { 
    Serial.println("0");
    lcd.print("0");
  }
  Serial.print("value: ");
  Serial.println(lightness);
   
  lcd.setCursor(0, 1);
   //clearLCD();
  lcd.print(lightness);
  
  delay(1000); //задержка 1 сек    
}
Exemplo n.º 6
0
// Allows user to change and select the time point
//  	index: index of the current time point
int CurveInput::getTimePoint( int index )
{
	initLCD(&col, &row);
	lcd.print("Enter Time ");
	lcd.print(index);
	lcd.print(" (s)");
	lcd.setCursor(0, 1);
	byte buttonID = NONE;
	int thisTime = times[index]; // scoping current time
	lcd.print(thisTime);
	col = 0; row = 1;
	lcd.setCursor(col, row);
	delay(SELECT_DURATION);
	int lowerLimit, upperLimit;
	getTimeLimits(index, &lowerLimit, &upperLimit);
	while ( buttonID != SELECT ) // any button other than SELECT
	{
		buttonID = btn.waitForButton();
		thisTime = btn.actionIncDec(buttonID, TIME_TEMP_DURATION,
		                            col, row, thisTime, 3,
		                            lowerLimit, upperLimit);
		                            // user adjusts time
	}
	return thisTime;
}
Exemplo n.º 7
0
void loop(){
  if(analogRead(0)<800)err=0;
  while(err!=1 && digitalRead(pinErr)!=HIGH){
    digitalWrite(pinR1, LOW);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("R1 ON");
    delay(5000);
    digitalWrite(pinR2, LOW);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("R2 ON");
    delay(5000);
    //if(analogRead(pinTemp)<=0 && analogRead(pinTemp)>=100) digitalWrite(pinR3, LOW);
    //else err=1;
    if(digitalRead(pinErr)==HIGH) {
      err=1;
      lcd.clear();
      lcd.print("Err R3");
      digitalWrite(pinR1, HIGH);
      digitalWrite(pinR2, HIGH);
      digitalWrite(pinR3, HIGH);
    }
  }
  lcd.setCursor(0,0);
  lcd.print("Error!");
  digitalWrite(pinR1, HIGH);
  digitalWrite(pinR2, HIGH);
  digitalWrite(pinR3, HIGH);

}
Exemplo n.º 8
0
// Allows user to change and select the time point
//  	index: index of the current time point
int CurveInput::getTimePoint( int index )
{
	initLCD(&col, &row);
	lcd.print("Duration ");
	lcd.print(index);
	lcd.print(" (s)");
	lcd.setCursor(0, 1);
	byte buttonID = NONE;
	int lowerLimit = 1;
	int upperLimit = 150;
	//times[index] = getTimeLimits(index, &lowerLimit, &upperLimit);
	int duration;
	if ( index == 1 ) duration = 125;
	else if ( index == 2 ) duration = 90;
	else if ( index == 3 ) duration = 90;
	else duration = 30;
	lcd.print(duration);
	col = 0; row = 1;
	lcd.setCursor(col, row);
	delay(SELECT_DURATION);
	while ( buttonID != SELECT ) // any button other than SELECT
	{
		buttonID = btn.waitForButton();
		duration = btn.actionIncDec(buttonID, TIME_TEMP_DURATION,
		                            col, row, duration, 3,
		                            lowerLimit, upperLimit);
		                            // user adjusts time
	}
	return times[index-1] + duration;
}
void LcdHandler::refrashScreen(int menuPosittion, double *setParameters, Menu *menu)
{
	lcd.clear();
	lcd.setCursor(0, 0);
	lcd.print(menu->getItem(menuPosittion));
	lcd.setCursor(0, 1);
	lcd.print((int)setParameters[menuPosittion]);
}
Exemplo n.º 10
0
// Prints curve choices on the LCD screen
void CurveInput::printCurveChoices()
{
	initLCD(&col, &row);
	lcd.print("A: Default Curve");
	lcd.setCursor(0, 1);
	lcd.print("B: User Curve");
	lcd.setCursor(0, 0);
}
Exemplo n.º 11
0
void loop()
{  
  // reads the value of the analog sensor
  int sensorVal = analogRead(sensorPin);
  
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);
  
  // converts the measure from the ADC (analog to digital converter) to volts
  float voltage = (sensorVal/1024.0)*5.0;
  
  Serial.print(", Volts: ");
  Serial.print(voltage);
  
  // turn volts into temperature in Celsius (C)
  float temperature = (voltage - 0.5)*100;
  
  Serial.print(", degrees C: ");
  Serial.println(temperature);
  
  if(temperature < baselineTemp)
  {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }
  else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4)
  {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  }
  else if(temperature >= baselineTemp+4 && temperature < baselineTemp+6)
  {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  }
  else if(temperature >= baselineTemp+6)
  {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
  }
  
  delay(750);
  
  // enumeration of th positions in the LCD start at 0
  
  lcd.setCursor(0, 0); // set the cursor of the LCD in the first position of the first row
  lcd.print(temperature); // print the value of the variable temperature in Celsius (C)
  lcd.print(" C");
  
  lcd.setCursor(0, 1);  // set the cursor of the LCD in the first position of the second row
  lcd.print(1.8*temperature + 32); // print the value of the variable temperature in Farenheit (F)
  lcd.print(" F");
  
}
Exemplo n.º 12
0
void loop()
{
lcd.setCursor(3,1);
lcd.write(1); // desenha o coração
delay(500);
lcd.setCursor(3,1);
lcd.print(" Hello World! "); // Após 0.5s apaga o coração, assim ele
delay(500); // ficará piscando
}
Exemplo n.º 13
0
void loop() {
  lcd.setCursor(0, 1);
  lcd.print(rotors[2]);
  lcd.setCursor(8, 1);
  lcd.print(rotors[1]);
  lcd.setCursor(15, 1);
  lcd.print(rotors[0]);
  delay(100);
}
Exemplo n.º 14
0
void Clock::printDateTime(void) {
	lcd.clear();
	lcd.setCursor(0, 0);

	printDate();
	// Start at beginning of second line
	lcd.setCursor(0, 1);

	printTime();
}
Exemplo n.º 15
0
void lcd_printMoisture(Moisture *moisture) {
	lcd.setCursor(4, 0);
	char pch[4];
	sprintf(pch, "%02d", moisture->proc);
	lcd.print(pch);

	lcd.setCursor(13, 0);
	sprintf(pch, "%02d", moisture->maxProc);
	lcd.print(pch);
}
Exemplo n.º 16
0
void StatsScreen::drawScreen( LiquidCrystal &_lcd ) {
	_lcd.clear();

	_lcd.setCursor(0, 0);
	_lcd.print("Taken: ");
	_lcd.print(taken);

	_lcd.setCursor(0, 1);
	_lcd.print("Next: ");
}
Exemplo n.º 17
0
/*
	Writing non-variable characters.
*/
void FirstWrite()
{
	lcd.clear();
	for (byte i = 0; i < ROWCOUNT; i++)
	{
		lcd.setCursor(0, i);
		lcd.print(prefix[i]);
		lcd.setCursor(LCDWIDTH - postfix[i].length(), i);
		lcd.print(postfix[i]);
	}
}
Exemplo n.º 18
0
void setup()
{
  lcd.begin(16, 2);                // initialise the LCD.
  pinMode(ledPin, OUTPUT);         // sets the digital pin as output
  pinMode(buttonPin, INPUT);       // not really necessary, pins default to INPUT anyway
  digitalWrite(buttonPin, HIGH);   // turn on pullup resistors. Wire button so that press shorts pin to ground.
  digitalWrite(stopButtonPin, HIGH);   // turn on pullup resistors. Wire button so that press shorts pin to ground.
  lcd.setCursor(0,0);
  lcd.print("System Ready...");
  lcd.setCursor(0,1);
}
void LcdHandler::printHomeScreen()
{
	lcd.clear();
	lcd.setCursor(0, 0);
	lcd.print("Temp: ");
	lcd.print((int)*temp);
	lcd.print(" C");
	lcd.setCursor(0, 1);
	lcd.print("Hum: ");
	lcd.print((int)*hum);
	lcd.print(" %");
}
void trigger() {
  lcd.clear();         // clears the screen and buffer
  lcd.setCursor(3,0);
  lcd.print("Time is up");
  
  lcd.setCursor(1, 1); // set timer position on lcd for end.
  lcd.print("END OF SHOWER");

  turnDownServo();
  delay(1000);
  lcd.display();
}
Exemplo n.º 21
0
void PIDControl::displayTemp(double currTemp, double setTempPoint)
{
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Cur Temp: ");
    lcd.print(currTemp);
    lcd.print(" C");
    lcd.setCursor(0,1);
    lcd.print("Set Temp: ");
    lcd.print(setTempPoint);
    lcd.print(" C");
    delay(2000);
}
Exemplo n.º 22
0
void Menux::showMenuOption(LiquidCrystal &lcd) {
	// Se envía al display el título del grupo de MenuOptions	
	lcd.clear();
	if (presentMenuCode == 1) {
		titleMenuOption = "Menu General";
	}
	lcd.setCursor(0, 0);
	lcd.print(titleMenuOption);
	// Se envía al display la MenuOption actual
	lcd.setCursor(0, 1);
	lcd.print(menuOptionList[presentOption].getOptionText());
	return;
}
Exemplo n.º 23
0
/*
	Writing numbers with padding.

	@param in number to be written.
	@param decimals decimal places.
	@param row to write the number.
*/
void PaddedWrite(double in, byte decimals, byte row)
{
	// decimal mark
	byte dm = 0;  if(decimals > 0) dm = 1;

	// clear row
	for (byte i = 0; i < (sides[row][1] - sides[row][0]); i++)
	{
		lcd.setCursor(sides[row][0] + i, row);
		lcd.write(' ');
	}
	lcd.setCursor(Padding(in, row) - dm - decimals, row);
	lcd.print((round(in * pow(10, decimals)) / pow(10, decimals)), decimals);
}
Exemplo n.º 24
0
void loop(){
  if(gameFinished == false){
    float time_to = random(1,2); //.. Aantal milliseconde om mee te beginnen
    int i;
    float current_multiplier = 0.98;
    float cashedOutMultiplier;
    int randomNumber = random(0,1000);
    if(randomNumber < 201){
      randomNumber = 0;
    }
    for(i = 0; i <= randomNumber; i++){
      switch (lcd_key){
        case btnSELECT:{
          cashedOut = true;
          cashedOutMultiplier = current_multiplier;
          break;
        }}
        lcd.clear();
        lcd.print("BustaDuino");  // print a simple message on the LCD
        lcd.setCursor(0, 1);
        if(randomNumber > 0){
          current_multiplier = current_multiplier + 0.01;
        }else{
          current_multiplier = 0;
        }
        
        lcd.print(String(current_multiplier) + "x");
        Serial.print(String(current_multiplier) + "x");
        lcd_key = read_LCD_buttons();   // read the buttons
        if(i <= randomNumber && cashedOut == true){
          lcd.clear();
          lcd.print("You Win!");
          lcd.setCursor(0, 1);
          lcd.print(String(cashedOutMultiplier) + "x");
          Serial.print(String(cashedOutMultiplier) + "x");
          gameFinished = true;
          break;
        }else if(i >= randomNumber && cashedOut == false){
          lcd.clear();
          lcd.print("BUSTED!");
          lcd.setCursor(0, 1);
          lcd.print(String(current_multiplier) + "x");
          Serial.print(String(current_multiplier) + "x");
          gameFinished = true;
        }
        delay((time_to/i) * 3000);
    }
  }
}
Exemplo n.º 25
0
/*	Stop timer function.
 *  Stops timer with the last lap time and display total time for the last lap.
 */
void StopTimer()
{
		elapsedTime = millis() - startTime;
		blinking = false;
		lcd.setCursor (15,0);
		lcd.print(" ");
		lcd.setCursor(0,1);
		lcd.print("                ");
		if ( TotalTime == 0) {
			printTime (elapsedTime, 0, 1, "Total:");
		}
		else printTime (TotalTime, 0, 1, "Total:");
		LapNumber=0;
		TotalTime = 0;
}
Exemplo n.º 26
0
void setup()
{
  SIM900.begin(9600);
  Serial.begin(9600);
  lcd.begin(16, 2);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  pinMode(10, OUTPUT);
  lcd.setCursor(3,0);
  lcd.print("CAR THEFT");
  lcd.setCursor(1,1);
  lcd.print("DETECTION SYS");
  delay(2000);
  lcd.clear();
}
Exemplo n.º 27
0
void debug(char *l, int i1, int i2) {
    int x = (pos % 2) * 10;
    int y = pos / 2;
    y = y % 4;
    lcd.setCursor(x,y);
    lcd.print("          ");
    lcd.setCursor(x,y);
    lcd.print(l);
    lcd.setCursor(x+2, y);
    lcd.print(i1);
    lcd.setCursor(x+6, y);
    lcd.print(i2);
    pos++;
    eraseNext(pos);
}
Exemplo n.º 28
0
void loop() {

  //Smoothing of weight and level sensor values
  raw = ((raw+offset)*.8+.2*analogRead(11)-offset);
  weight = raw *171/27;
  if(weight <0) weight = 0;
  motion = .2*motion + .8*readDistance(motionTrig,motionEcho)/58;
  right = .9*right + .1*(readDistance(rightTrig,rightEcho)/58);

  //Sends weight over serial as 2 bytes
  Serial1.write((int)weight / 256);
  Serial1.write((int)weight % 256);
  delay(500);

  left = .9*left + .1*readDistance(leftTrig,leftEcho)/58;
  rfill = (raverage-right-2)/(raverage-2) * 100.0;
  lfill = (laverage-left-2)/(laverage-2) * 100.0;

    if(rfill <0) rfill = 0;
    if(lfill <0) lfill = 0;
    fill=(lfill+rfill)/2;

    if (motion<20 && pos == 0) {
      open();

    }
    else if (motion >20 && pos > 0){
      close();
    }

    //Sets position and text on LCD display
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("W: ");
    lcd.print((int)weight);
    lcd.setCursor(8,0);
    lcd.print("M: ");
    lcd.print(motion);
    lcd.setCursor(0,1);
    lcd.print("L: ");
    lcd.print((int)lfill);
    lcd.print("%");
    lcd.setCursor(8,1);
    lcd.print("R: ");
    lcd.print((int)rfill);
    lcd.print("%");
    Serial.println(userselected);
}
Exemplo n.º 29
0
void loop() {
    static bool show_warning = false;
    int result = dht11.read();

    switch (result) {
    case Dht11::OK:
        Serial.println("Read ok");
        break;
    case Dht11::ERROR_TIMEOUT:
        Serial.println("Timeout");
        return;
    case Dht11::ERROR_CHECKSUM:
        Serial.println("Checksum error");
        return;
    default:
        Serial.println("WTF?");
        return;
    }

    lcd.setCursor(0, 0);
    lcd.print("T: ");
    // lcd.print(dht11.getTemperature());
    // lcd.print(" | ");
    // We trust more the thermistor than the humidity sensor...
    // The last one was giving **really** unrealistic results.
    float temperature = Tmp36AvgTemperature();
    lcd.print(temperature, 2);
    lcd.print(" C");

    lcd.setCursor(0, 1);
    lcd.print("Hum: ");
    lcd.print(dht11.getHumidity());
    lcd.print('%');

    if (temperature > TEMPERATURE_MAX ||
            temperature < TEMPERATURE_MIN)
        show_warning = !show_warning;
    else
        show_warning = false;

    lcd.setCursor(LCD_COLS - 3, 0);
    if (show_warning)
        lcd.print("(!)");
    else
        lcd.print("   ");

    delay(500);
}
void setup(){
  // Voltage sensors

  for (int i; i < countVoltagePins; i++) {
    pinMode(voltagePins[i], INPUT);
  }
  
  // Heartbeat LED
  pinMode(LEDpin, OUTPUT);
  
  // Serial port is used for debug
  Serial.begin(9600);
  
  // LCD
  lcd.begin(LCDcols, LCDlines);
  
  // Welcome
  lcd.setCursor(0, 0);
  lcd.print("Paleo 2011  2012");
  
  // Relays
  initRelays();
  
  // Init watchdog
  wdt_enable(WDTO_8S);
}