// The loop function is called in an endless loop
void loop() {
	delay(SENSOR_CHANGE_TRIGGER_TIME);
	unsigned long unchangedTime = millis() - lastMotionDetected;
	if (unchangedTime < MAX_ON_TIME) {
		lcd.display();
		lcd.backlight();
		switch (sensor) {
		case TEMPERATURE_SENSOR_NUM:
			setTemperature();
			break;
		case HUMIDITY_SENSOR_NUM:
			setHumidity();
			break;
		case SOIL_SENSOR_NUM:
			setSoilHumidity();
			break;
		case PRESSURE_SENSOR_NUM:
			setPressure();
			break;
		}
	} else {
		lcd.noDisplay();
		lcd.noBacklight();
	}
	delay(500);
}
Esempio n. 2
0
void WeatherStation::disableBeforeSleep()
{
    volatile uint8_t *out, *ddr;
    uint8_t i;

    setCurrentDate();

    lcd.noBacklight();

    sensorMgt.stop();

    overTime = 0;

    delay(100);

    /**close ports**/
    for( i = 0; i < PALETTE_PORT_NUM; i++ )
    {
        ddr = portModeRegister(ioPort[i]);
        out = portOutputRegister(ioPort[i]);

        ioPreDDRValue[i] = *ddr;
        ioPrePORTValue[i] = *out;

        (*ddr) &= ioDisableMask[i];
        (*out) &= ioDisableMask[i];
    }


}
Esempio n. 3
0
void setup()/*----( SETUP: RUNS ONCE )----*/
{
  lcd.begin(20, 4);        // initialize the lcd for 20 chars 4 lines and turn on backlight
  
  // Open serial communications and wait for port to open:
  Serial.begin(9600);

  // --- button setup

  pinMode(RunBtn, INPUT);
  pinMode(ChangeScanBtn, INPUT);

  digitalWrite(RunBtn, HIGH);
  digitalWrite(ChangeScanBtn, HIGH);


  pinMode(clampPin, OUTPUT);      // sets the digital pin as OUTPUT to drive FET clamp)

  pinMode(5, OUTPUT);      // sets the digital pin as output
  pinMode(6, OUTPUT);      // sets the digital pin as output
  pinMode(7, OUTPUT);      // sets the digital pin as output
  pinMode(11, OUTPUT);     // pin11= PWM  output / frequency output //Will Turner - This could go to pin 5 from 11.  CHANGED TO 9 AS IT WOULDNT REACH OTHERS


  // ------- Quick 3 blinks of backlight  -------------
  for (int i = 0; i < 3; i++)
  {
    lcd.backlight();
    delay(20);
    lcd.noBacklight();
    delay(20);
  }
  lcd.backlight(); // finish with backlight on

  //-------- Initialise display ----------------
  // NOTE: Cursor Position: CHAR, LINE) start at 0
  lcd.setCursor(0, 0); //Start at character 0 on line 0
  lcd.print("Tension Tester v1.5 "); // sets up the screen for the wire number and layer number being recorded
  lcd.setCursor(0, 2);
  lcd.print("     Press Run      ");

  Setup_timer2();

  // disable interrupts to avoid timing distortion
  cbi (TIMSK0, TOIE0);             // disable Timer0 !!! delay() is now not available
  sbi (TIMSK2, TOIE2);             // enable Timer2 Interrupt

  dfreq = 1000.0;                  // initial output frequency = 1000.o Hz
  tword_m = pow(2, 32) * dfreq / refclk; // calulate DDS new tuning word

  // setup start and end frequencies of sweep

  // setup initial values for loop
  adcflag = false;

  analogval = 0;
  digitalWrite(clampPin, HIGH);    // sets the pin high to short out large signals before amp (using a FET as clamp)
  avgcnt = 0.0;
}
Esempio n. 4
0
void setPower(int state){
	power = state;
	lcd.setCursor(0,1);
	if(state==1){
		lcd.print("   Power ON     ");	
		lcd.backlight();
	}else{
		lcd.print("   Power OFF    ");	
		lcd.noBacklight();
	}

}
Esempio n. 5
0
void flashx3() {
// ------- Quick 3 blinks of backlight  -------------
for (int i = 0; i < 3; i++)
{
  lcd.backlight();
  delay(2000);
  lcd.noBacklight();
  delay(2000);
}
lcd.backlight(); // finish with backlight on

//-------- Initialise display ----------------
}
Esempio n. 6
0
void setup()
{
  Serial.begin(115200);
 
  //Setup Channel A
  pinMode(X_DIR_PIN, OUTPUT); //Initiates Motor Channel A pin
  pinMode(Y_DIR_PIN, OUTPUT); //Initiates Motor Channel A pin
  pinMode(9, OUTPUT); //Initiates Brake Channel A pin
  pinMode(A0,INPUT);
  pinMode(X_MIN_PIN,INPUT_PULLUP);
  pinMode(X_MAX_PIN,INPUT_PULLUP);
  pinMode(X_JOY_LEFT,INPUT_PULLUP);
  pinMode(X_JOY_RIGHT,INPUT_PULLUP);
  pinMode(Y_JOY_DOWN,INPUT_PULLUP);
  pinMode(Y_JOY_UP,INPUT_PULLUP);
  // Quadrature encoders
  // X encoder
  pinMode(c_XEncoderPinA, INPUT);      // sets pin A as input
  digitalWrite(c_XEncoderPinA, LOW);  // turn on pullup resistors
  pinMode(c_XEncoderPinB, INPUT);      // sets pin B as input
  digitalWrite(c_XEncoderPinB, LOW);  // turn on pullup resistors
  attachInterrupt(c_XEncoderInterrupt, HandleLeftMotorInterruptA, RISING);
 
  // Y encoder
  pinMode(c_YEncoderPinA, INPUT);      // sets pin A as input
  digitalWrite(c_YEncoderPinA, LOW);  // turn on pullup resistors
  pinMode(c_YEncoderPinB, INPUT);      // sets pin B as input
  digitalWrite(c_YEncoderPinB, LOW);  // turn on pullup resistors
  attachInterrupt(c_YEncoderInterrupt, HandleRightMotorInterruptA, RISING);
  
  
  lcd.begin(20,4);         // initialize the lcd for 20 chars 4 lines, turn on backlight

// ------- Quick 3 blinks of backlight  -------------
  for(int i = 0; i< 3; i++)
  {
    lcd.backlight();
    delay(150);
    lcd.noBacklight();
    delay(150);
  }
  lcd.backlight(); // finish with backlight on  

//-------- Write characters on the display ------------------
  // NOTE: Cursor Position: Lines and Characters start at 0  
  lcd.setCursor(3,0); //Start at character 4 on line 0
  lcd.print("Hello, world!");
 

}/*--(end setup )---*/
Esempio n. 7
0
/*********************
 * Setup function
 * *******************/
void setup()  {
  time_t start, fadeIn, stop, fadeOut;

  Wire.begin();

  setSyncProvider(RTC.get);

  lcd.init();
  lcd.noBacklight();

  led.loadEepromDatas();

  pinMode(ledPin, OUTPUT);

  kpd.init();

  initMenuItems();
}
Esempio n. 8
0
void init()
{

	spiffs_mount(); 
	Serial.begin(230400); // 115200 by default

	Serial.systemDebugOutput(false); // Enable debug output to serial

	Wire.begin();	
	lcd.begin(16,2);               // initialize the lcd 

	for(int i = 0; i< 3; i++)
	{
		lcd.backlight();
		delay(150);
		lcd.noBacklight();
		delay(250);
	}
	lcd.backlight();
	
    lcd.setCursor(0,0);
    lcd.clear();
    lcd.print("    Music Box   ");
    lcd.setCursor(0,1);
    lcd.print("    Geek Labs   ");
	SystemClock.setTimeZone(3);
	printTimer.initializeMs(1000*60, onPrintSystemTime).start();
	
	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(true); // Enable debug output to serial
	WifiStation.enable(true);
	WifiStation.config(WIFI_SSID, WIFI_PWD);
	WifiAccessPoint.enable(false);
	
	Wire.beginTransmission(PT2258_ADDRESS); 
	Wire.write(0xC0);
	Wire.endTransmission();
		
	// Run our method when station was connected to AP
	WifiStation.waitConnection(connectOk, 30, connectFail);
}
Esempio n. 9
0
void LcdnoBacklight() {
  lcd27.noBacklight();
  lcd3E.noBacklight();
}
Esempio n. 10
0
void DisplayClass::noBacklight() const
{
	lcd.noBacklight();
}